Sunday, 2 December 2012

Column or table name conflicting with keyword in SQL Server


Sometimes we face a problem in SQL Server that column name or table name is same as one of the keyword of SQL server, like Session, Description etc. which might cause some syntax errors.

For example:
Select  Description  From Session

It will show you highlighted Description and Session as if it is treating both as keyword. and your whole statement will become blue :-P.


To differentiate keyword and names of your column and table, you can use squar brackets around the column or table name. like

Select  [Description]  From [Session]

Hope this help someone.!!

No comments:

Post a Comment