@@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT

@@IDENTITY, SCOPE_IDENTITY 和 IDENT_CURRENT都返回表的IDENTITY列的最後一個插入的值。

@@IDENTITY and SCOPE_IDENTITY return the last identity value generated in any table in the current session. However, SCOPE_IDENTITY returns the value only within the current scope; @@IDENTITY is not limited to a specific scope.

IDENT_CURRENT is not limited by scope and session; it is limited to a specified table.


https://msdn.microsoft.com/en-us/library/ms187342.aspx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章