Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alter column's default value

I have a table which has a column 'CompanyID int not null' and its default value is set to 10. Now I want to write a query which will alter this default value to 1. How can can I do it?

Any help will be appreciated. I am using SQL server 2000.

like image 412
user92027 Avatar asked Dec 08 '09 09:12

user92027


1 Answers

I think the best you can do is drop the constraint and create it again:

alter table dbo.yourTable
drop constraint default_value_name_constraint
go
alter table dbo.yourTable
add constraint default_value_name_constraint default YourValue for ColumnName
go
like image 81
Jonathan Avatar answered Sep 23 '22 13:09

Jonathan