I am using SQL Server 2008 and Navicat. I need to rename a column in a table using SQL.
ALTER TABLE table_name RENAME COLUMN old_name to new_name;
This statement doesn't work.
You can use sp_rename like this
EXEC sp_RENAME 'TableName.OldColumn_Name’, 'NewColumn_Name', 'COLUMN'
For more information you can refer to sp_rename (Transact-SQL)
Refer to this to get more details related to rename SQL SERVER – How to Rename a Column Name or Table Name
Specifically, for your case you can use this way:
EXEC sp_RENAME 'table_name.oldname', 'newname', 'COLUMN'
To enclose your values, always use single quotes.