问题:
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