Help - Search - Members - Calendar
Full Version: SQL statement question
Hostony Board > General Support > General Support
2ltrlg
Hello,
I'm a newbie at SQL and trying to query a DB using SQL with ASP.

SQL statement:
SELECT Description, Last Name FROM Contacts ORDER BY Description

Error:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Last Name'.

Note: I only get this error when the name of a table or column in the table has a space (i.e Last Name). If I take out "Last Name" it works.

Question:
I know the "Last Name" column is in the table ... does SQL mandate no spaces? If not, how can I make this work, without changing the names already established in my table?? I've tried using single quotes like 'Last Name'

Thanks
artrocity
I dont use MSSQL but in MySQL single quotes work.

You should try backticks
SELECT Description, `Last Name` FROM Contacts ORDER BY Description
Alexandre
I hope this link will help you:
http://forums.devarticles.com/t2860/s.html...lhost!!!
smile.gif
2ltrlg
Many thanks artrocity ... the backticks worked!
artrocity
QUOTE(2ltrlg @ Jan 9 2005, 07:16 AM)
Many thanks artrocity ... the backticks worked!


No problem! smile.gif

I was hoping you read my response
as i was not sure what that devshed article had to
do with your question rolleyes.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here