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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reserved word DESC workaround for JOIN statement

Status
Not open for further replies.

neroe

Technical User
Feb 27, 2003
54
0
0
GB
Hello

I've written the following SQL which works fine;

select members.FIRSTNAME, members.LASTNAME, bookings.REF, bookings.EVENTNO
from members
inner join bookings on members.REF = bookings.REF

I'd like to add one more field from another table. The name of the field is DESC and I had intended it look like this in the statement;

events.DESC

I get an 'incorrect syntax near 'DESC'' error because it is a reserved word. Is there anyway around this except for renaming the field?

Thanks.
 
Works perfect, thanks.
 
BTW DESC in SQL is short for Descending used in the order by clause.

Usually a good practice not to use reserved words.

Simi
 
I agree with Simi. If you don't have much code around that uses this column, now would be the best time to change the name. It gets much harder once you have a lot of code that uses it.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top