posted by 네코냥이 2013. 12. 30. 14:59

No need for a separate SELECT...

INSERT INTO table (name)
OUTPUT Inserted.ID
VALUES('bob');

This works for non-IDENTITY columns (such as GUIDs) too



SQL Server - Return value after INSERT - Stack Overflow.pdf


'.NET > MS-SQL' 카테고리의 다른 글

[MS-SQL] 컬럼명 제약조건 추가하기  (0) 2014.01.06
SET ARITHABORT(Transact-SQL)  (0) 2014.01.02
SQL Server Stored Procedure capture return value in T-SQL  (0) 2013.12.30
인덱스 유형  (0) 2013.12.26
[MS-SQL] 인덱스 옵션  (0) 2013.09.01