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.
| Author |
Topic |
|
dba123
Yak Posting Veteran
90 Posts |
Posted - 2008-01-18 : 15:21:27
|
| I can't see the problemIncorrect syntax near '('.IF NOT EXISTS (SELECT iPrerCourID FROM Cla_Prere (nolock) WHERE iClsID = 9859 AND iPrerCourID = 948) BEGIN INSERT INTO [MyDB].[dbo].[Cla_Prere] ([iClsID] ,[iPrerCourID] ,[tiRecordStatus] ,[dtDateCreated] ,[dtDateLastChange] ,[bMandatory]) -- sql 2005 Output Into clause for Rollback output inserted.* into mydbbck.dbo.test7476 VALUES (9859 ,948 ,1 ,GetDate() ,GetDate() ,1) ENDIt appears it doesn't like my output inserted clause but I've used this before in a single insert like this. I don't see why it's complaining. If I take it out it works, but the point is, I have a bunch of inserts in this script and I want to use that output inserted in each insert. I can't even get this one insert to stop complaining. Is it because I have the output inserted inside an exists clause? I've used this output inserted just like this before but it was not wrapped inside an exists. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-01-18 : 15:40:48
|
| Probably your database is still in SQL Server 2000 compatibility mode where OUTPUT INSERTED keyword is non-existent.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
dba123
Yak Posting Veteran
90 Posts |
Posted - 2008-01-18 : 15:46:09
|
quote: Originally posted by harsh_athalye Probably your database is still in SQL Server 2000 compatibility mode where OUTPUT INSERTED keyword is non-existent.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
No, the database is 2005, and as I said I've used the output clause just fine without the exists |
 |
|
|
dba123
Yak Posting Veteran
90 Posts |
Posted - 2008-01-18 : 15:50:18
|
Nevermind, that script is not the problem. I had another insert that had FROMClass_Prerequisite in it, missing the space after the FROMquote: Originally posted by dba123
quote: Originally posted by harsh_athalye Probably your database is still in SQL Server 2000 compatibility mode where OUTPUT INSERTED keyword is non-existent.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
No, the database is 2005, and as I said I've used the output clause just fine without the exists
|
 |
|
|
|
|
|
|
|