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 |
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-06-08 : 05:51:14
|
| i had a existing table with 5 columns. i has to add a column sap_id wih type numeric(28,0) with not null constraint (not to allow null values). how can we do thisSudhakar |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-06-08 : 05:54:19
|
| In a existing table (with data) you can't include a not not column.Instead of this you do like this.1.Include a column with null (i.e allow null)2.update value into the new column.3.Now set the not null constrain.Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceled |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-06-08 : 07:12:13
|
| add column with default value for already existing table. |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2009-06-08 : 08:07:20
|
| ALTER TABLE tablename ADD sap_id NUMERIC(28,0) NOT NULL default(0)- Lumbago |
 |
|
|
|
|
|