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 |
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2004-11-07 : 17:58:17
|
| Hi All,I have a table with columns 'col1','col2','Col3'Currently All three columns are int type and allows NULL valuePlease tell me what will be syntax to modify all three columns to make these NOT NULL and default value 100.Thanksmk_garg |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-11-07 : 18:33:03
|
| alter table mytbl alter column col1 int not nullalter table mytbl add default 100 for col1repeat for all cols - you'll have to update to remove any nulls first==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
mk_garg20
Constraint Violating Yak Guru
343 Posts |
Posted - 2004-11-07 : 19:19:04
|
| Thanks nrmk_garg |
 |
|
|
xbcnn
Starting Member
14 Posts |
Posted - 2004-11-24 : 20:42:14
|
| Now if I want to drop the default value 100 on one of columns,What is the SQL script? |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-11-24 : 20:52:20
|
| Use sp_help to find the name of the default thenalter table mytbl drop constraint <defaultname>have you seen thishttp://www.nigelrivett.net/AlterTableProblems.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|