Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Query

Author  Topic 

PeeJay2583
Starting Member

40 Posts

Posted - 2011-05-17 : 06:00:42
Hi,

I have a access query which I have modified and trying to use in sql query however getting an error message "Msg 402, Level 16, State 1, Line 1
The data types nvarchar and varchar are incompatible in the boolean AND operator."

The query I am using is
INSERT INTO [Table_EPAR Hours by Release ALL RELEASES] ( Merge, Release, appl_nm, ProjectID, PriorRelease_Hours, CurrentRelease_Hours )
SELECT [Table_All SPRFs by App].[ProjectID] & ' ' & [Table_All SPRFs by App].[appl_nm] & ' ' & [Release] AS Merge, '2011Q1' AS Release, [Table_All SPRFs by App].appl_nm, [Table_All SPRFs by App].ProjectID, [Table_EPARImport 2010].[Inception Actual Hours], [Table_EPARImport 2011].[Inception Actual Hours]
FROM ([Table_All SPRFs by App] LEFT JOIN [Table_EPARImport 2010] ON ([Table_All SPRFs by App].ProjectID = [Table_EPARImport 2010].ProjectID) AND ([Table_All SPRFs by App].appl_nm = [Table_EPARImport 2010].appl_nm)) LEFT JOIN [Table_EPARImport 2011] ON ([Table_All SPRFs by App].appl_nm = [Table_EPARImport 2011].appl_nm) AND ([Table_All SPRFs by App].ProjectID = [Table_EPARImport 2011].ProjectID);

Can anyone help where the problem is occuring.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-17 : 06:07:12
Replace & by +
+ is the string concatenate operator in sql server.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -