Get Started
5923

Q: Which dml command is used in conjunction with @@identity?

  • 1
    INSERT and UPDATE
  • 2
    UPDATE and DELETE
  • 3
    SCOPE_IDENTITY and IDENT_CURRENT
  • 4
    Commit and rollback
  • Show 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.

The Most Comprehensive Exam Preparation Platform

Get the Examsbook Prep App Today