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 |
|
KidSQL
Yak Posting Veteran
88 Posts |
Posted - 2005-04-27 : 17:02:56
|
| I was just wondering how I could go about changing the names of columns in some of my tables using Query Analyzer. I have been doing this in Enterprise Manager, which is lovely, but it's not very practical when I have dozens of column names to deal with.I was thinking I would have to use somethign likeupdate mytable set mytable.ColumnName(oldcolumn) = "New_Column"but this doesn't seem to work. Any ideas would be greatly appreciated.Thanks! |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-04-27 : 17:11:56
|
| Use sp_rename:create table junk (col1 int)GOselect * from junkgosp_rename 'junk.col1', 'colA', 'column'goselect * from junkGOdrop table junkBe One with the OptimizerTG |
 |
|
|
KidSQL
Yak Posting Veteran
88 Posts |
Posted - 2005-04-27 : 17:17:55
|
| Thanks, TG (as per usual)! |
 |
|
|
|
|
|