Good day. The task is to register and it is necessary to record the data and the pots to display the data. You need to do everything in 1 request. How to be?
1 answer
You need to use OUTPUT in your insert request.
Extract from the documentation for SQL Server, the full text can be read on the link
OUTPUT (Transact-SQL) Clause:
Returns data from rows that have changed as a result of an INSERT, UPDATE, DELETE, or MERGE statement, or an expression based on this data. These results can be returned to the application, for example, to display confirmation messages, archiving, etc. The results can also be inserted into a table or table variable. In addition, you can write the results of an OUTPUT clause in nested INSERT, UPDATE, DELETE, or MERGE statements and insert these results into the target table or view.
|
insert into token output inserted.* values(...)- Mike