日期:2014-05-18 浏览次数:20479 次
INSERT INTO IP_Dev_ChangeBak Select d.ID, Col1=case when d.Col1=i.Col1 then '' else d.Col1 end, Col1=case when d.Col2=i.Col2 then '' else d.Col2 end FROM Deleted as d inner join inserted i on d.ID=i.ID
------解决方案--------------------
declare @newcusts table ( customerid Nchar(5) not null primary key, keycol int not null unique ); insert into dbo.customerdim(customerid,companyname) output inserted.customerid,inserted.keycol into @newcusts sql2005新功能. @newcusts 表变量可以是一张表.. output 出去的可以是所有列也可以是任意一列.