获取插入的最后一行
我有一个将记录插入差异表的触发器,但我需要获取插入触发器内的记录,我该怎么做?没有标识字段,只有由插入表上的单独触发器生成的 account_nbr。
我不知道是否有sql语句来检索刚刚插入的行。
数据库是Sql Server 2008。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OUTPUT 子句将返回刚刚插入的记录: http://msdn .microsoft.com/en-us/library/ms177564.aspx
如果您指的是在调用触发器之前插入的行,则它们位于
inserted
伪-桌子。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.