大家好,本人有一个关于SQL Server 2000触发器的问题请教
大家好,本人有一个关于SQL Server 2000触发器的问题请教,如下:
1.分别有Employees表和Log表;
2.Employees表里面有Employeeid,Technical字段,
3.Log表里面有Employeeid,Date,OldTechnical,NewTechnical字段,
问题:
当Employees表里面的Technical字段更新时,就在Log表里面的Date字段插入更改日期,OldTechnical字段插入原Technical,NewTechnical字段插入更新后的Technical.
感谢!!!
[解决办法]
create trigger triTest on Employeesfor updateasif update(Technical) insert Log select a.create trigger triTest on Employeesfor updateasif update(Technical) insert Log select a.Employeeid,getdate(),a.Technical,b.Technical from deleted a,inserted b where a.Employeeid=b.Employeeid
[解决办法]
create trigger triTest on Employeesfor updateasif update(Technical) insert Log select a.Employeeid,getdate(),a.Technical,b.Technical from deleted a,inserted b where a.Employeeid=b.Employeeid
[解决办法]
--当Employees表里面的Technical字段更新时,就在Log表里面的Date字段插入更改日期,OldTechnical字段插入原--Technical,NewTechnical字段插入更新后的Technical. create trigger 触发器名 on Employeesafter updateasbegininsert into logselect a.Employeeid,getdate(),b.Technical,a.Technical from inserted a left join deleted bon a.Employeeid=b.Employeeidend