sql server identity 列的一些方法

来源:互联网 发布:淘宝的登录名怎么修改 编辑:程序博客网 时间:2024/04/30 01:43
select ident_current('tb')  ---返回表tb最后一个插入的identity列的值select @@IDENTITY  ----返回最新插入的identity值select SCOPE_IDENTITY()  ----返回最新插入的identity值--@@identity 和 scope_identity()的区别是 @@identity 的作用域是全部的回话,不只是当前表,会返回所有域中--刚插入的identity值,scope_identity() 只返回当前回话中新插入的identity值select IDENT_INCR('tb')  ---返回表tb identity列的原始增量值select IDENT_SEED('tb')  ---返回表tb identity列的原始种子值,即起始值