Hi,
I have the following dynamic SQL query which inserts values in a WHILE loop using a cursor:
This works, however if I extend it to include an INT insert as follows:
I get the following error:
Syntax error converting the nvarchar value 'Insert into [tblDWResponseData1] (dwr_UserID, dwr_UserEmail, dwr_cam_id) values ('01F0849A-DC1F-4D22-967A-676C2FD7F666','r@d.com',' to a column of data type int.
Can anyone help with this?
Thanks!
Rick
I have the following dynamic SQL query which inserts values in a WHILE loop using a cursor:
Code:
select @sql = 'Insert into [' + @dwrm_ResponseDataTable + '] (dwr_UserID, dwr_UserEmail) values (''' + @UserID + ''',''' + @UserName + ''')'
exec (@sql)
This works, however if I extend it to include an INT insert as follows:
Code:
select @sql = 'Insert into [' + @dwrm_ResponseDataTable + '] (dwr_UserID, dwr_UserEmail, dwr_cam_id) values (''' + @UserID + ''',''' + @UserName + ''',' + @cam_id + ')'
exec (@sql)
I get the following error:
Syntax error converting the nvarchar value 'Insert into [tblDWResponseData1] (dwr_UserID, dwr_UserEmail, dwr_cam_id) values ('01F0849A-DC1F-4D22-967A-676C2FD7F666','r@d.com',' to a column of data type int.
Can anyone help with this?
Thanks!
Rick