January 2, 2019
TSQL – Getting New Primary Key
Like
(3)
Comments
(3)
3
3
There are so many ways to getting a Primary Key from a table right after an INSERT, which should you use? Trick question. You get it when you do the INSERT, not after.
Resources
3 Comments
2019-01-09 18:10:37
I tried to see if I could get to work. I made a query, but that field is not available in my result. It does not seem to be universally available.
If it would have worked, I would have ran
SELECT top 100 deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC
To see what query it did to get the results
~~~~
If someone gets this to work, I would like to know what it does.
Like
()
Add Comment
You must be logged in to post a comment.