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 |
|
skiabox
Posting Yak Master
169 Posts |
Posted - 2008-10-30 : 05:32:17
|
| Can I use more than one add command in the same alter <table> command?Thank you! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-30 : 05:35:35
|
| you can have more than one columns after add likeALTER TABLE tablename ADD col1 int,col2 varchar(10),... |
 |
|
|
skiabox
Posting Yak Master
169 Posts |
Posted - 2008-10-30 : 05:48:06
|
| Thank you very much, in fact after the comma I used a constraint. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-30 : 05:54:35
|
| Can you please show us code you tried? |
 |
|
|
skiabox
Posting Yak Master
169 Posts |
Posted - 2008-10-30 : 05:58:06
|
| Yea no problem.Here's the code:ALTER TABLE buildingsADD typeName nvarchar(20) NOT NULL, CONSTRAINT buildings_fk2 FOREIGN KEY (typeName) REFERENCES building_type ON UPDATE CASCADE ON DELETE NO ACTION |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-30 : 06:04:52
|
| it works for me |
 |
|
|
|
|
|