CREATE TRIGGER trig_Insert_Employee
ON Emp
FOR INSERT
AS
Begin
Insert into dbo.backtable (id, insertdate) select MAX(id),GETDATE() from Emp
End
here
Emp is table name , whenever emp table gets insert the trigger will get fired!
insert into Emp(id,name) values(2,'First')
select * from sys.objects where type='TR'
The above query will display the triggers in database. and it holds parent object id.
ON Emp
FOR INSERT
AS
Begin
Insert into dbo.backtable (id, insertdate) select MAX(id),GETDATE() from Emp
End
here
Emp is table name , whenever emp table gets insert the trigger will get fired!
insert into Emp(id,name) values(2,'First')
select * from sys.objects where type='TR'
The above query will display the triggers in database. and it holds parent object id.