SQL Server - 获取插入行标识的最佳方法? [英] SQL Server - Best way to get identity of inserted row?

查看:28
本文介绍了SQL Server - 获取插入行标识的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取插入行的 IDENTITY 的最佳方法是什么?

What is the best way to get IDENTITY of inserted row?

我知道 @@IDENTITYIDENT_CURRENTSCOPE_IDENTITY,但不了解它们各自的优缺点.

I know about @@IDENTITY and IDENT_CURRENT and SCOPE_IDENTITY but don't understand the pros and cons attached to each.

有人可以解释一下不同之处以及我应该何时使用它们吗?

Can someone please explain the differences and when I should be using each?

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆