Contact Us Today!   |   + 1 (301) 424 3903



SQL Reserved word or not, that is the question

Here is a problem that we had on a recent project that we were doing maintenance on. The code had some queries with a table called as "user". The code works fine on the production server but gave an error on our development server. The fix? Put brackets around the table name in all the queries.

eg

select name from [user]

instead of

select name from user


We had different versions of SQL Server on the two boxes and user is now a reserved word on the development box version.

We figure out what words are reserved using Pete Freitag's reserved word tool at:

http://www.petefreitag.com/tools/sql_reserved_words_checker/?word=user

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Sana's Gravatar Its nice tool, but does not catch all reserved word.
Read this interesting blog post from Ben:
http://www.bennadel.com/blog/1005-Exercise-List-De...
# Posted By Sana | 10/25/07 5:14 PM
Oil paintings's Gravatar Some tools have their own rules,and they do not catch all reserved words,
so I think we should understand the rules of the SQL which we want to use.
# Posted By Oil paintings | 3/5/08 11:18 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner