SQL Server, Trigger -> Variable Table - TechRepublic
General discussion
July 25, 2002 at 01:49 AM
dmarro

SQL Server, Trigger -> Variable Table

by dmarro . Updated 23 years, 10 months ago

How can i perform an insert, using the deleted table in a MS SQL server 2000 Trigger? I want to pass the name of the receiving table as a variable. The following does not work.

Create Trigger [CRF_01_AbioScoreAudit] On dbo.CRF_01_AbioScore
For Delete, Insert, Update as
Declare @AuditTabName VarChar(60)
Set @AuditTabName= ‘CRF_01_AbioScore_Audit’
Insert Into @AuditTabName
Select GetTime(),’Inserted’, Current_User,* From Deleted

This discussion is locked

All Comments