When inserting a row into a database table that contains an identity column, I need a way to capture the identity value generated by the database engine after it inserts the row into this table. What can I use to capture this value while also making sure this value is accurate?
SQL Server provides three different functions for capturing the last generated identity value on a table that contains an identity column:
But which should you use? Check out this article for more information: