set nocount on
go
if object_id('tr_tbl') is not null
        drop table tr_tbl
go
create table tr_tbl(i int)
go
create trigger tr_test on tr_tbl for insert, update, delete as
if exists(select * from inserted) and exists(select * from deleted)
        print 'Update...'
else
 if exists(select * from inserted)
        print 'Insert...'
 else 
        print 'Delete...'
go

insert tr_tbl values(1)
update tr_tbl set i = i + 1
delete tr_tbl
This page was last updated on May 01, 2006 04:28 PM.