When renaming a column name, a square bracket is included in the column name, which I think is an error. Here is an example code snippet,
create table [TestTable]
(TestColumnName nvarchar(30))
select TestColumnName from TestTable
sp_rename '[TestTable].[TestColumnName]', '[RenamedColumnName]', 'Column'
select [RenamedColumnName] from TestTable
select RenamedColumnName from TestTable
select * from [TestTable]
the error is that the rename column contains square brackets , I found this , which says that "the first character must be one of the following", but " [ " does not seem to be included in the list, there is a problem with sp_rename or sql server , because it allows you to change the name of a column using a square bracket.
81967 source
share