sql查询返回主键 [英] sql query return primary key
本文介绍了sql查询返回主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在插入查询中插入sql server 2005后如何返回主键?.请帮助我解决此问题.
how to return primary key after inserting in sql server 2005 in insert query?.please help me about this question.
推荐答案
单个insert语句将自动返回最后插入的标识值.
您还可以使用以下内容:
A single insert statement will automatically return the last inserted identity value.
You can use the following also :
select @@IDENTITY
select @@IDENTITY;
详细信息此处 [
More info here[^].
使用存储过程定义out参数.阅读以下内容,
http://msdn.microsoft.com/en-us/library/ks9f57t0% 28vs.71%29.aspx
Define the out parameter with a stored procedure. Read the following,
http://msdn.microsoft.com/en-us/library/ks9f57t0%28vs.71%29.aspx
这篇关于sql查询返回主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文