Q: Which dml command is used in conjunction with @@identity?
- 1INSERT and UPDATEfalse
- 2UPDATE and DELETEfalse
- 3SCOPE_IDENTITY and IDENT_CURRENTtrue
- 4Commit and rollbackfalse
- Show AnswerHide Answer
- Workspace
Answer : 3. "SCOPE_IDENTITY and IDENT_CURRENT"
Explanation :
Answer: C) SCOPE_IDENTITY and IDENT_CURRENT Explanation: Using automatically incrementing IDENTITY columns is very popular with database developers. You don’t need to explicitly calculate unique surrogate keys when inserting new data, the IDENTITY column functionality does that for you. The IDENTITY feature also allows you to specify useful Seed and Increment properties. When you use an INSERT statement to insert data into a table with an IDENTITY column defined, SQL Server will generate a new IDENTITY value. You can use the @@IDENTITY variable and the SCOPE_IDENTITY and IDENT_CURRENT functions to return the last IDENTITY value that has been generated by SQL Server. This is very useful when you need to return the key for the row that has just been inserted, back to the caller.