How to add a default value to an already existing column?
Posted
by Earlz
on Stack Overflow
See other posts from Stack Overflow
or by Earlz
Published on 2010-06-17T00:11:36Z
Indexed on
2010/06/17
0:22 UTC
Read the original article
Hit count: 573
I have an existing column in my SQL Server database. I have tried about everything I can think of but can not get a default value to be added to the column. What works in every other database is
alter table mytable
alter column mycolumn set default(now()) --mycolumn is a datetime
How do I do this in SQL Server?
The error I get for that exact syntax is incorrect syntax near the keyword 'set'
© Stack Overflow or respective owner