ScubaManDan
ScubaManDan

Reputation: 839

Error with output clause in insert statement

I'm a little stumped as to why my output clause won't work. Am I doing something silly? I keep getting the error, " Incorrect syntax near 'output'."

--Create the table to insert into, with identity
create table #testtab(
    businessno int identity(1,1),
    businessname varchar(100), 
    businessref varchar(50), 
    moduser varchar(10), 
    moddate datetime, 
    modtype char(1)
);

--Insert statement with output to capture inserted id numbers
insert into #testtab (businessname, businessref, moduser, moddate, modtype) 
output inserted.businessno,inserted.businessref
values('asd','asd','asd',getdate(),'x');

This is in 2008R2.

Thanks, Dan

Upvotes: 0

Views: 810

Answers (1)

ScubaManDan
ScubaManDan

Reputation: 839

Ah.... my bad. I was actually connected to a SQL 2000 instance from SSMS. Woops. Doesn't look like 2000 supports output. Sigh

Upvotes: 3

Related Questions