The OUTPUT
clause is compatible with SQL Server 2005 but not SQL Server 2000.
How do I convert this command to work in SQL Server 2000?
CREATE TABLE sample
(
ID uniqueidentifier NOT NULL DEFAULT newid(),
Title varchar(30) NOT NULL
)
INSERT INTO sample (Title)
OUTPUT INSERTED.ID
VALUES ('Test1')
I need the command to retrieve the ID since the INSERT
command needs to be called from a stored procedure.
Thanks for any help!
INSERT
command that works on different tables (some withint IDENTITY(1,1)
and some withuniqueidentifier
).I need to use theDEFAULT newid()
. – Reductive