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;
Since I often come here and then wondering how to use the brackets, this answer might be useful for those like me.
EXEC sp_rename '[DB].[dbo].[Tablename].OldColumnName', 'NewColumnName', 'COLUMN';
OldColumnName
must not be in []
. It will not work.NewColumnName
into []
, it will result into [[NewColumnName]]
.