var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Alter Column datatype with Default constraint
I need to alter the datatype of a column from smallint to decimal (14,2) but the column was originally created with the following:
add col_1 smallint Not Null
constraint df_my_table__col_1 default 0
I want to keep the default constraint, but i get errors when I try to do the following to alter the datatype:
alter table my_table
alter column col_1 decimal(14,2) Not Null
Do I need to drop the constraint before I alter the column and then rebuild the constraint? An example would be helpful.
yes thats right,
the constraint has a dependency on the column and hence the data type of the column.
If you change the data type then you change the column and then this affects the constraint which SQL Server will not allow.
drop the constriant, then do what you need to do to the column