Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
honeytjames
Starting Member
3 Posts |
Posted - 2008-10-07 : 23:32:03
|
| Hi,I know we can use the following code to specify default constraints for a new column but can someone tell me how to specify a default constraint for an already existing column?ALTER TABLE TestTableADD NewCol VARCHAR(50)CONSTRAINT DF_TestTable_NewCol DEFAULT '' NOT NULLGOAny help would be greatly appreciated!!!Thanx in advance.. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-07 : 23:33:00
|
| use alter table alter columnALTER TABLE TestTableALTER COLUMN NewCol VARCHAR(50)CONSTRAINT DF_TestTable_NewCol DEFAULT '' NOT NULLGO |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-10-08 : 11:55:18
|
| ALTER TABLE TestTable ADD CONSTRAINT DF_TestTable_NewCol DEFAULT '' FOR NewCol |
 |
|
|
|
|
|