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 |
|
shubhada
Posting Yak Master
117 Posts |
Posted - 2006-02-16 : 02:13:03
|
| I am trying to rename the column name with new name of existing table using followig syntaxALTER TABLE test1 RENAME COLUMN total to sumbut i got the following error.Server: Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'COLUMN'.please tell me how I can rename the column.shubhada |
|
|
shallu1_gupta
Constraint Violating Yak Guru
394 Posts |
Posted - 2006-02-16 : 02:23:05
|
| Hi shubhada,Use sp_rename 'table.columnname','newname','Column'Pls make sure that references to the column are also been updated. |
 |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-02-16 : 02:27:42
|
| also, avoid using reserved words for column and table names.-ec |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-16 : 03:07:58
|
| Also, if possible you can keep the column as it is and use alias name when queryingSelect total as NewAliasName from yourTableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|