used a script to rename a column which has caused a problem…
sp_RENAME 'products.isvalid' , '[_is_valid_system]', 'COLUMN'
Now I have a column name with square brackets in, and I can’t access the column to resolve the problem.
Column Name:
[_is_valid_system]
An attempt to repair the issue like so fails because of the special characters in the command:
sp_RENAME 'products.[_is_valid_system]' , '_is_valid_system', 'COLUMN'
Any way of escaping these characters?
Even if I can just select from the column that will be good enough, but the following obviously does not work because of the special meaning of squared brackets in SQL server.
select [is_valid_system] from products
Try
sp_RENAME 'products."[_is_valid_system]"' , '_is_valid_system', 'COLUMN'