How to manipulate a column with a name used by querys in SQL?


I have a table in SQL server with the name default , but the problem is that SQL uses the word 'default' to do something else. Then I can not manipulate the default column of my table. In what way can I do it? I can not edit the name of the variable because the table is not mine.

asked by Eduardo Huerta 28.11.2018 в 14:53

1 answer


In the case of SQL Server you can use one of the identity delimiters to differentiate the name of that column from reserved words:

  • []
  • ""

Since default is a reserved word , then you can write the query like this:

select [default] as foo from TABLE

Or so:

select "default" as foo from TABLE

Although it is not advisable to use reserved words for table or column names.

answered by 28.11.2018 / 15:19