Hi experts I need your help with this,
I am very new to all this..
@TBLNM and @FILEID is a ResultSet parameter from SSIS that is "Foreach Loop Container" with a value/field in another table
@TBLNM varchar (20),
I have this bit of code within a Stored Procedure and I know that it is not going to work:
select @sql = 'IF OBJECT_ID [dbo]. +('@TBLNM') IS NOT NULL' + 'ALTER TABLE [dbo].' + @TBLNM + ' DELETE CONSTRAINT [CK_' + @TBLNM + '_Max_File_ID] + ''
DROP TABLE [dbo].' + @TBLNM + '
FROM ' + @TBLNM + '
WHERE ' + @TBLNM + '.[FILE_ID] = ' + cast(@fileId as varchar(20))+ ' AND
WHERE #CLAIM_TEMP.CLM_KY = ' + @TBLNM + '.CLM_KY AND
#CLAIM_TEMP.[FILE_ID] = ' + cast(@fileId as varchar(20)) + ')';
I want to be able to:
If table exit
Alter table constriants
I need to correct this code.
Please help and thanks