Friday, March 9, 2012

Drop column on compatibility level 65

I have a database converted from sybase to SQL Server and the application
requires the database compatibility level 65.
I am trying to drop a column by Enterprise Manager and by Query Analyser
(Alter table xxx drop column yyy). Both came back with error "Incorrect
syntax". It is because drop column do not support on database compatibility
level 65.
Can you please advise what is another alternative way ?Unfortunately you are unable to use DROP TABLE as part of an ALTER TABLE
command in SQL Server 6.5, hence are unable to do this using SQL Server 6.5
compatibility mode. In order to drop a column in SQL Server 6.5
compatibility mode you will need to follow the steps below:
- Script the Permissions of the table you wish to drop the column from
- Create a New table without the column you want to drop
- Move the data from the Original table to the New table
- Drop the Original table
- Rename the New table to the Original table name (sp_rename)
- Re-Apply the Permissions to the table
- Run sp_recompile for the table
- Peter Ward
WARDY IT Solutions
"Johnny" wrote:

> I have a database converted from sybase to SQL Server and the application
> requires the database compatibility level 65.
> I am trying to drop a column by Enterprise Manager and by Query Analyser
> (Alter table xxx drop column yyy). Both came back with error "Incorrect
> syntax". It is because drop column do not support on database compatibili
ty
> level 65.
> Can you please advise what is another alternative way ?
>

No comments:

Post a Comment