Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql keyword as a column name

Status
Not open for further replies.

afcbchezza

Programmer
Oct 19, 2006
2
GB
Is there a workaround you can explain to me that allows me to SELECT a column named 'language'? As 'language' is a keyword this presents a problem with my SQL. Changing the coloumn name is not an option.

Many thanks for your help.
 
It may depend on the database used, but I recommend you try putting square brackets around the field name, like so...

Select field1, [language], field2 from table ....

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
According to the ANSI/ISO SQL-99 standard:
SQL identifiers consist of a sequence of one or more characters.

SQL identifiers (except for delimited identifiers) must begin with a letter, and may only contain letters, digits and the special character "_".

The case of letters in identifiers is not significant, unless it is a delimited identifier. All non-delimited letters are treated as uppercase.

Delimited identifiers means identifiers enclosed in double quotation marks: "". Such identifiers are special in three aspects:
- They can contain characters normally not supported in SQL
identifiers, e.g. @.
- They can be identical to a reserved word.
- They are treated in a case-sensitive manner.

I.e. what you want is "language"

(Which I think even MS SQL Server supports...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top