IDENT_CURRENT ,@@IDENTITY, SCOPE_IDENTITY
来源:互联网 发布:2015年淘宝店铺解封 编辑:程序博客网 时间:2024/05/18 00:44
- IDENT_CURRENT returns the last identity value generated for a specific table in any session and any scope.
- @@IDENTITY returns the last identity value generated for any table in the current session, across all scopes.
- SCOPE_IDENTITY returns the last identity value generated for any table in the current session and the current scope.
IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the value generated for a specific table in any session and any scope. For more information, see
SCOPE_IDENTITY and @@IDENTITY return the last identity values that are generated in any table in the current session. However, SCOPE_IDENTITY returns values inserted only within the current scope; @@IDENTITY is not limited to a specific scope.
For example, there are two tables, T1 and T2, and an INSERT trigger is defined on T1. When a row is inserted to T1, the trigger fires and inserts a row in T2. This scenario illustrates two scopes: the insert on T1, and the insert on T2 by the trigger.
Assuming that both T1 and T2 have identity columns, @@IDENTITY and SCOPE_IDENTITY will return different values at the end of an INSERT statement on T1. @@IDENTITY will return the last identity column value inserted across any scope in the current session. This is the value inserted in T2. SCOPE_IDENTITY() will return the IDENTITY value inserted in T1. This was the last insert that occurred in the same scope. The SCOPE_IDENTITY() function will return the null value if the function is invoked before any INSERT statements into an identity column occur in the scope.
USE AdventureWorks;
GO
SELECT IDENT_CURRENT ('Person.Address') AS Current_Identity;
GO
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
- IDENT_CURRENT ,@@IDENTITY, SCOPE_IDENTITY
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
- SCOPE_IDENTITY、IDENT_CURRENT、@@IDENTITY
- 区分 @@IDENTITY,SCOPE_IDENTITY,IDENT_CURRENT
- @@IDENTITY IDENT_CURRENT SCOPE_IDENTITY区别
- @@IDENTITY,SCOPE_IDENTITY,IDENT_CURRENT
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
- @@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT
- @@IDENTITY,SCOPE_IDENTITY和IDENT_CURRENT【通俗易懂】
- 浅谈SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
- IDENT_CURRENT('表名')、@@IDENTITY、SCOPE_IDENTITY
- @@IDENTITY、IDENT_CURRENT、SCOPE_IDENTITY的区别
- IDENT_CURRENT ,@@identity,SCOPE_IDENTITY() 之间对比
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY的比较
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY的比较
- SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY的比较
- DB2 工具
- 标准的的Flash插入
- j2se GUI 编程
- Div+Css酷站一箩筐
- html框架
- IDENT_CURRENT ,@@IDENTITY, SCOPE_IDENTITY
- singleton模式及static成员数据的继承
- Asterisk目录及配置文件
- 常用正则表达式
- 40种网页常用小技巧(javascript) ,自动刷新,网页技巧
- TEMP_FAILURE_RETRY宏的应用(很好用)
- 網頁設計必備 - 測試網站瀏覽器相容性的 WEB Application
- junit4的教程
- 获取连接端的地址以及自己的地址