How can this be made to handle multiple ID's to delete?
Thanks
John Fuhrman
Code:
DECLARE @RC int
DECLARE @Reciept_Number varchar(max)
DECLARE @ID_Number varchar(max)
Set @Reciept_Number =
N'LIN1190136015'
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
Set @ID_Number = (Select ID
From dbo.LETTER_DETAILS t
Inner Join (Select items From fn_Split(@Reciept_Number,',')) As SplitValues
On t.RECEIPT_NUMBER = SplitValues.items)
-- Where CREATED_ON < dateadd(dd,-10,getdate()))
---- EXECUTE @RC = [NSC_SQL].[dbo].[usp_Delete_Case_By_ID]
---- @ID_Number
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
Delete from dbo.LETTER_DETAILS
Where Exists
(Select ID
From dbo.LETTER_DETAILS t
Inner Join (Select items From fn_Split(@Reciept_Number,',')) As SplitValues
On t.RECEIPT_NUMBER = SplitValues.items)
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
Select ID, NUMBER, RECEIPT_NUMBER, DS_NO, DATE_OF_MEMO, LETTER_TYPE,
CREATED_ON, CREATED_BY
From dbo.LETTER_DETAILS t
Inner Join (Select items From fn_Split(@Reciept_Number,',')) As SplitValues
On t.RECEIPT_NUMBER = SplitValues.items
-- Where CREATED_ON < dateadd(dd,-1,getdate())
Order by t.RECEIPT_NUMBER
Thanks
John Fuhrman