CREATE TRIGGER 插入 ON 表
FOR INSERT 
AS
insert northwind..prodcuts select * from inserted
go
CREATE TRIGGER 删除 ON 表
FOR DELETE 
AS
delete northwind..prodcuts where 编号 in (select 编号 from deleted)
go
CREATE TRIGGER 修改 ON 表
FOR update 
AS
update northwind..prodcuts set 所有列=AA.所有列 from inserted AA where AA.编号=northwind..prodcuts.编号
go

解决方案 »

  1.   

    CREATE TRIGGER your_trgger ON 表
    FOR INSERT,update,deleteselect * from insertedselect * from deleted不知道你说的打印是什么意思,如需要可以插入到某张表中记录下来,再打印CREATE TRIGGER your_trgger ON 表
    FOR INSERT,update,deleteinsert into table_bak(col1, col2...)
    select 'inserted',* from insertedinsert into table_bak(col1, col2...)
    select 'deleted',* from deleted
      

  2.   

    use northwind
    go
    create trigger 表名  on products for insert,update 
    as
      begin 
      print 'select * from inserted'
    end 
    go
    create trigger 表名 on products for delete,update
    as 
     begin 
     print 'select * from deleted'
    end 
    go
           我把语句写成这样,应该也可以吧,请帮我 看看写的对不对,谢谢!