I am trying to run below and get this error even though the columns is a integer.???
CAST(@CAMPCOUNT AS INTEGER) IS THE Issue in below query:
DECLARE
@CAMPCOUNT INTEGER,...
SET @SQLinsert = 'INSERT INTO ' + @DBName + 'WAVE_QC_HISTORY
(Exec_ID, Test_Number, Test_Name, Test_Result, Pass_Fail)
SELECT ' + CAST(@EXEC_ID AS VARCHAR(10)) + ', 1
,' + '''Find any xyz''' + '
, count(*)
, case when (count(*) - '+ CAST(@CAMPCOUNT AS INTEGER) + ' <> 0 then ' + '''Failed''' + ' else ' + '''Passed''' + ' end
FOLLOWING works:
SET @SQLinsert = 'INSERT INTO ' + @DBName + 'WAVE_QC_HISTORY
(Exec_ID, Test_Number, Test_Name, Test_Result, Pass_Fail)
SELECT ' + CAST(@EXEC_ID AS VARCHAR(10)) + ', 1
,' + '''Find any xyz''' + '
, count(*)
, case when (count(*) <> 0 then ' + '''Failed''' + ' else ' + '''Passed''' + ' end
CAST(@CAMPCOUNT AS INTEGER) IS THE Issue in below query:
DECLARE
@CAMPCOUNT INTEGER,...
SET @SQLinsert = 'INSERT INTO ' + @DBName + 'WAVE_QC_HISTORY
(Exec_ID, Test_Number, Test_Name, Test_Result, Pass_Fail)
SELECT ' + CAST(@EXEC_ID AS VARCHAR(10)) + ', 1
,' + '''Find any xyz''' + '
, count(*)
, case when (count(*) - '+ CAST(@CAMPCOUNT AS INTEGER) + ' <> 0 then ' + '''Failed''' + ' else ' + '''Passed''' + ' end
FOLLOWING works:
SET @SQLinsert = 'INSERT INTO ' + @DBName + 'WAVE_QC_HISTORY
(Exec_ID, Test_Number, Test_Name, Test_Result, Pass_Fail)
SELECT ' + CAST(@EXEC_ID AS VARCHAR(10)) + ', 1
,' + '''Find any xyz''' + '
, count(*)
, case when (count(*) <> 0 then ' + '''Failed''' + ' else ' + '''Passed''' + ' end