|
3
|
| Malik Daud Ahmad Khokhar · 技术社区 · 17 年前 |
|
|
1
4
或多或少是这样的……要么是这样,要么只是将存储过程中的值作为输出参数返回。 |
|
2
5
顺便说一句,在大多数情况下,您应该使用scope_identity()而不是@@identity。 Ref . |
|
|
3
2
一点值得一提。您真的应该使用scope_标识在插入后返回标识值。@@identity有可能返回错误的值。尤其是在使用触发器时,在插入后将值写入其他表。 见 Books Online 页了解更多详细信息。 |
|
|
4
1
有人说用 ident_current('表名') http://www.velocityreviews.com/forums/t303448-return-identity-after-sql-insert.html |
|
|
5
0
在我看来,您希望使用标量值执行
正如其他人提到的,我认为使用scope_identity()比@@identity变量更安全 |