March 18th, 2013, 12:48 PM
Join Date: Aug 2003
Time spent in forums: 2 h 50 m 13 sec
Reputation Power: 0
SQL 2008 vs 2005 New Error on "If"
I have a query that generates a table and its fields that works in 2005. Now I am on a 2008 Server and the query no longer works.
Was working code:
if exists (select * from dbo.sysobjects where id = object_id(N'dbo.NCOS_Data') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE dbo.NCOS_Data
CREATE TABLE dbo.NCOS_Data (
NC_UniqueID int identity(1,1),
NC_Lead_Number varchar (50)
Now I get this error in 2008
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'if'.