declare @t table (logId int,customerId int,amount int)

insert into log( customerId,amount)

output

inserted.Id,inserted.CustomerId,inserted.Amount

into @t

values(@coustomerId,@amount)

 

select * from @t

 

可以不使用 @@identity了

 

类似的还有delete output ,update output 可以把原记录保存到日志里,而不需要单独查询一次了,非常好用

相关文章:

  • 2021-08-10
  • 2021-11-04
  • 2021-10-30
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案