Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 OUTPUT clause

Author  Topic 

siumui
Yak Posting Veteran

54 Posts

Posted - 2012-03-20 : 13:49:19
I have an error that says, "Incorrect syntax near 'OUTPUT'." from the codes below:

--declare table variable
DECLARE @EmpDeleted table (id NUMERIC, f_name varchar(20), l_name varchar(20))

DELETE FROM #emp
WHERE sales IS NULL
OUTPUT DELETED.id, DELETED.f_name, DELETED.l_name
INTO @EmpDeleted


Help please.
Thank you.




siumui

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-03-20 : 13:53:04
[code]DELETE FROM #emp
OUTPUT DELETED.id, DELETED.f_name, DELETED.l_name
INTO @EmpDeleted
WHERE sales IS NULL

[/code]









How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

siumui
Yak Posting Veteran

54 Posts

Posted - 2012-03-20 : 13:55:09
Thank you!!:0)

siumui
Go to Top of Page
   

- Advertisement -