How to select a column in SQL Server with a special character in the column name?

前端 未结 1 1632
囚心锁ツ
囚心锁ツ 2020-12-19 04:29

I have a table contain the \'%\' in the column title, and this cause problem when I do the select statement on that column (Find below for more details). Does anyone know ho

相关标签:
1条回答
  • 2020-12-19 05:05

    You may want to wrap your column name in square brackets to have your identifier delimited:

    SELECT [%Phone] FROM Table1
    

    If the QUOTED_IDENTIFIER option is set to ON, you can also use ANSI-SQL compliant double quotation marks to delimit identifiers:

    SELECT "%Phone" FROM Table1
    
    0 讨论(0)
提交回复
热议问题