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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error Renaming Column

Author  Topic 

kathyc
Starting Member

9 Posts

Posted - 2008-08-16 : 17:09:23
Hi,

I need to rename a column "height" to height_cms"

Here is my query:

ALTER TABLE basic RENAME height TO height_cms;


Here is the error message:

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver]
[SQL Server]Line 1: Incorrect syntax near 'height'.,

What am I doing wrong?


Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-16 : 17:29:35
sp_rename 'basic.height', 'height_cms'

There might be som additional parameters to set. I can't remember right now.
You can look up sp_rename in Books Online for more information.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-08-16 : 18:32:37
sp_rename 'basic.height', 'height_cms', 'column'

Greetings
Webfred


Too Old to Rock 'n' Roll, Too Young to Die
Go to Top of Page
   

- Advertisement -