So basically let's say that you are creating a query dynamically
if you do
set @strSQL = 'select col1, col2, [abc[]def] from yourtable'
This will fail, because SQL will think that the column name is [abc[]. So to solve the problem you need to escape the ] character so that SQL understand that it's a literal character. The way of doing that is by repeating the character.
set @strSQL = 'select col1, col2, [abc[]]def] from yourtable' --this will be ok.
Now I wouldn't define any columns with any special characters such us the brackets. Just my two cents.
So basically let's say that you are creating a query dynamically
if you do
set @strSQL = 'select col1, col2, [abc[]def] from yourtable'
This will fail, because SQL will think that the column name is [abc[]. So to solve the problem you need to escape the ] character so that SQL understand that it's a literal character. The way of doing that is by repeating the character.
set @strSQL = 'select col1, col2, [abc[]]def] from yourtable' --this will be ok.
Now I wouldn't define any columns with any special characters such us the brackets. Just my two cents.