That's correct.
The OUTPUT
clause is useful for debugging/testing.
Also, you can redirect its output into a history table as a log of what was inserted.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Sample taken from https://stackoverflow.com/a/48932734
INSERT INTO #Jedi
OUTPUT INSERTED.*
SELECT 'Luke' AS [Jedi_names], 'Skywalker' AS [Jedi_surname]
just do not understand what will happen for the above statement.
1) first select will give some data that will be inserted into temp table and then those temp table data will be inserted into OUTPUT ?
is my understanding is correct ?
That's correct.
The OUTPUT
clause is useful for debugging/testing.
Also, you can redirect its output into a history table as a log of what was inserted.