SQL Server 2005 Output 方法
SQL Server 2005 Output Method
Summary: An example of how an inserted ID can be returned using the OUTPUT method in SQL Server 2005
- CREATE TABLE #Test
- (
- ID INT IDENTITY(1,1),
- Value VARCHAR(10) NOT NULL,
- )
- INSERT INTO #Test (Value)
- OUTPUT Inserted.ID AS ID
- VALUES ('Value 1')