Can't seem to get this working.
Just want to copy the rows that would be deleted to another table then remove the record from the main table.
Thanks
John Fuhrman
Just want to copy the rows that would be deleted to another table then remove the record from the main table.
Code:
USE SQL_TEST
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Trigger [dbo].[trg_PSafety_Delete_Details]
On dbo.PSafety_LETTER_DETAILS
Instead of Delete
As
Begin
Set Nocount On
Select *
Into dbo.PK_PSafety_LETTER_DETAILS_DELETED
From dbo.PSafety_LETTER_DETAILS As ld
Inner Join Deleted As d
On ld.ID = d.ID
Delete ld
From dbo.PSafety_LETTER_DETAILS ld
Inner Join Deleted As d
On ld.ID = d.ID
End
Thanks
John Fuhrman