I was working on Sql server 2000 which was migrated from older version to sql server 2000.
I have added a column to an existing table using the following query:
alter table test add col1 varchar(1)
And afterwards I wanted to delete that column. I have tried the following query for that
alter table [test] drop column [col1]
but its always giving me the following error message :
This query executed successfully.
'test' table
- Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 2: Incorrect syntax near 'col1'.
Same error I was getting when I tried deleting the column from Enterprise Manager.
Resolution :
first run the following query & check the compatibility :
sp_dbcmptlevel databaseName
If the compatability level is 65, change it to 70 or 80 by using the following query:
sp_dbcmptlevel databaseName,70
Now the delete query will be executed without fail.
No comments:
Post a Comment