The following yields error:
SELECT 1 AS [dada[daa]]
Msg 105, Level 15, State 1, Line 190 Unclosed quotation mark after the character string 'dada[daa] '.
Msg 102, Level 15, State 1, Line 190 Incorrect syntax near 'dada[daa] '.
and if I have square brackets in the column alias, I can use quotes like this:
SELECT 1 AS 'dada[daa]'
but I am building some complex dynamic T-SQL statements and each column alias is enclosed with square brackets and using quotes if the alias contains brackets will make things a little bit harder.
So, is there a way to escape these brackets somehow?