I am executing a stored procedure using SSIS and am passing one parameter to that SP
The passing of the parameter works fine.
I just need to get this part to work:
PRINT 'STARTING UPDATE OF CLAIM RECORDS IN DATABASE_TABLES: ' + @TBLNM
SET @rc = 1
WHILE @rc > 0
SELECT @sql = 'IF OBJECT_ID (''dbo.' + @TBLNM + ''') IS NULL
UPDATE DATABASE_TABLES set TBL_STAT = ' +'DELETED' + 'WHERE TBL_NM =' + @TBL_NM +' and TBL_STAT =' + 'PURGE_ELIG'
exec sp_executesql @sql;
SET @rc = @@ROWCOUNT
PRINT 'ENDING UPDATE OF CLAIM RECORDS IN DATABASE_TABLES: ' + @TBLNM
The reason why I am using a dynamic query is because of the parameter "@TBLNM"
I want to make sure the table that is indicated by the @TBLNM is NOT there (Has already been deleted) then to mark it in the record of DATABASE_TABLES as 'DELETED' in the correct field "TBL_STAT "
I know I am close to solving and just wanted an expert touch to finish it off...
Please help and thanks