create trigger trigger_name
on {table_name | view_name}
{for | After | Instead of }
[ insert, update,delete ]
as
sql_statement
on {table_name | view_name}
{for | After | Instead of }
[ insert, update,delete ]
as
sql_statement
aaa
实例:
create trigger cmdinserted
on ctrdevcmds
for insert
as
declare @id numeric(15,0)
select @id=id from inserted
update ctrdevcmds set send_time=GETDATE(),back_time=GETDATE(),status='2' where id=@id
on ctrdevcmds
for insert
as
declare @id numeric(15,0)
select @id=id from inserted
update ctrdevcmds set send_time=GETDATE(),back_time=GETDATE(),status='2' where id=@id