开发者

Get last row inserted

开发者 https://www.devze.com 2023-03-08 21:41 出处:网络
I have a trigger that inserts a record into a diff table but I need to get that record that was inserted inside the trigger, how do I do it? There is no identity开发者_高级运维 field, only account_nbr

I have a trigger that inserts a record into a diff table but I need to get that record that was inserted inside the trigger, how do I do it? There is no identity开发者_高级运维 field, only account_nbr that is generated by a separate trigger on the insert table.

I don't know if there is sql statements to retrieve a row that was just inserted.

DB is Sql Server 2008.


The OUTPUT clause will give you back the records you have just inserted: http://msdn.microsoft.com/en-us/library/ms177564.aspx

If you mean the rows inserted before the trigger invoked, they are in the inserted pseudo-table.

0

精彩评论

暂无评论...
验证码 换一张
取 消