What is the difference between Scope_Identity(), Identity(), @@Identity, and Ident_Current()?

后端 未结 7 1393
灰色年华
灰色年华 2020-11-22 06:49

I know Scope_Identity(), Identity(), @@Identity, and Ident_Current() all get the value of the identity column, but I woul

7条回答
  •  萌比男神i
    2020-11-22 07:18

    Scope Identity: Identity of last record added within the stored procedure being executed.

    @@Identity: Identity of last record added within the query batch, or as a result of the query e.g. a procedure that performs an insert, the then fires a trigger that then inserts a record will return the identity of the inserted record from the trigger.

    IdentCurrent: The last identity allocated for the table.

提交回复
热议问题