Question

We want to change a column type from smallint to decimal. The 'alter table' sql statement passed in a UAT db server but failed in a production server. DBA suggests it could be related to the 'default' constraint of the column but that is all the help we got.

I am thinking of dropping the default off first before altering the column type.

I tried this sql statement:

alter table MyTable alter MyColumn drop default

But I got this error message:

Error: Incorrect syntax near the keyword 'alter'.

SQLState:  ZZZZZ
ErrorCode: 156

What is wrong with this syntax? The target DB is 15.5

I used this as syntax reference

Was it helpful?

Solution

I'm going to guess that you may be using Sybase ASE, given the version number you listed, and the fact that the Sybase IQ syntax gave you an error message.

For SAP Sybase ASE you would drop the default using the sp_unbindefault command.

sp_unbindefault 'MyTable.MyColumn'

Documentation: Adaptive Server Enterprise 15.5 > Reference Manual: Procedures > System Procedures

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top