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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 EXCEPT

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-30 : 10:46:18
i get this error why:
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'EXCEPT'.

SELECT * 
FROM DB1.dbo.tbl1
WHERE DATEPART(m,DateTran)=8
EXCEPT
SELECT *
FROM DB2.dbo.tbl2
WHERE DATEPART(m,DateTran)=8

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-09-30 : 10:49:32
What is your compatibility level set to?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-30 : 10:52:42
quote:
Originally posted by inbs

i get this error why:
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'EXCEPT'.

SELECT * 
FROM DB1.dbo.tbl1
WHERE DATEPART(m,DateTran)=8
EXCEPT
SELECT *
FROM DB2.dbo.tbl2
WHERE DATEPART(m,DateTran)=8



What is the compatibility level of the database?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-30 : 10:53:04


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-30 : 11:02:32
DataBase Compatibility level 80
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-30 : 11:05:57
quote:
Originally posted by inbs

DataBase Compatibility level 80


You need to change it to 90 by

EXEC sp_dbcmptlevel 'your_db',90

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-09-30 : 11:08:06
thanks, i export the data to another server i have sql 2008 on it.
Go to Top of Page
   

- Advertisement -