"NA" +@cnt
[Integration] DECLARE @cnt INT = 1; DECLARE @S#No INT = 0; DECLARE @Val varchar(255); set @S#No=(select max(S#No) from [dbo].[AD_Data_Ruf]) print @S#No WHILE @cnt < @S#No BEGIN DECLARE @EmailAddress nvarchar(250) set @EmailAddress=(select [Email Address] from [dbo].[AD_Data_Ruf] where S#No = @cnt) --PRINT 'Inside simulated FOR LOOP on TechOnTheNet.com'; if(@EmailAddress='"NA" +@cnt') set @Val = 'NA' +@cnt; update [dbo].[AD_Data_Ruf] set [Email Address] =@Val PRINT @EmailAddress SET @cnt = @cnt + 1; END; --PRINT 'Done simulated FOR LOOP on TechOnTheNet.com'; GO
set @Val = 'NA' +@cnt;
@cnt
Msg 245, Level 16, State 1, Line 16 Conversion failed when converting the varchar value 'NA' to data type int.
@Val
set @Val = 'NA' + CAST(@cnt AS varchar(12));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)