Insert last row

I have a trigger that inserts an entry into the diff table, but I need to get this record that was inserted inside the trigger, how do I do this? There is no identifier field, only account_nbr, which is generated by a separate trigger in the insert table.

I do not know if there are SQL queries to retrieve the row that was just inserted.

DB is Sql Server 2008.

+4
source share
1 answer

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

If you mean lines inserted before the trigger is called, they are in the inserted pseudo- inserted .

+5
source

All Articles