Home > Archive > MS SQL Server > November 2006 > Re: Query where feild name is reserved









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Query where feild name is reserved
Arnie Rowland

2006-11-09, 7:14 pm

When encountering any object name that is a reserved word, enclose it in
either double quotes, or square brackets.

"desc" or [desc]

And when you use multiple part names, such as:

MyDatabase.dbo.Table

enclose on the reserved word part of the name in delimiters:

MyDatabase.dbo.[Table]

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous

You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf


<Scamp@nospam.com> wrote in message
news:i187l2tkup4aols
7dv9kvbr4gfjd51626t@
4ax.com...
> Using query analyzer, how can I return a column (desc in this case)
> that is also a reserved word?
>
> I'm working with a commercial product so I can't change the name of
> the column.
>
> I've tried things like:
>
> Select desc from foo
> Select 'desc' from foo
> select id,desc from foo
>
> etc...
>
> each one gives me: Error near reserved word 'desc'
>
>
>
> Thanks.
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com