SQL Server - 插入后的返回值 - SQL Server - Return value after INSERT

问题:

I'm trying to get a the key-value back after an INSERT-statement.我试图在 INSERT 语句后取回键值。 Example: I've got a table with the attributes name and id.示例:我有一个带有属性名称和 ID 的表。 id is a generated value. id 是生成的值。

    INSERT INTO table (name) VALUES('bob');

Now I want to get the id back in the same step.现在我想在同一步骤中取回 id。 How is this done?这是怎么做的?

We're using Microsoft SQL Server 2008.我们使用的是 Microsoft SQL Server 2008。


解决方案:

参考一: https://en.stackoom.com/question/XDkl
参考二: https://stackoom.com/question/XDkl
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章