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 |
|
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2012-02-17 : 10:38:03
|
| Having trouble with the syntax of a simple insert.I want to copy TableA to TableB after TableB has been modified so the firstColumn is a new Column. I want to put the same value into each row of the newColumn.Something like :Insert into TableBSelect 'Constant', TableB.* from TableBCan someone put me right?Thanks |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-02-17 : 10:49:36
|
try SELECT INTO:Select 'Constant', fileA.* into fileB from fileA |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-17 : 13:12:59
|
quote: Originally posted by AdamWest Having trouble with the syntax of a simple insert.I want to copy TableA to TableB after TableB has been modified so the firstColumn is a new Column. I want to put the same value into each row of the newColumn.Something like :Insert into TableBSelect 'Constant', TableB.* from TableBCan someone put me right?Thanks
if you want to modify TableB first do ALTER TABLE ...ADD... to create new column. then use above query to populate it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|