Sunday, October 31, 2010

TRIGGER ON AFTER INSERTION OF DATA



create trigger afterinsert_trigger1
on emp
AFTER INSERT
as
begin
declare @name varchar(50)
declare @fname varchar(50)
select @name=name from inserted
select @fname=fname from inserted
select @ser=ser_num     from inserted
insert into copy(name,fname,ser_num)values(@name,@fname,@ser)
PRINT 'AFTER TRIGGER EXECUTED SUCESSFULLY'
end
GO

insert into emp(name,fname)values('xzz','xxaa');

 AFTER TRIGGER EXECUTED SUCESSFULLY

(1 row(s) affected)
AFTER TRIGGER EXECUTED SUCESSFULLY

(1 row(s) affected)


select * from copy




 

0 comments:

Post a Comment