Write SQL for a Field Name with spaces

How can I write a SQL statement for a Table field's name wiht a space.
For example
Table:=User
"User Name", "User ID", ... ect.

SQL Statement
Select * From User Order by User.User?IO

ysimonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
Try:

Select * From User Order by "User.User IO"

Cheers,

Raymond.
 
0
SuperSyCommented:
Simon;

We are getting a notification e-mail about "comment added" from EE for <YSun@sci-s.com>, and I assume you are not getting the notification because of this.  

I personally want to forward the notifications to you, but alas I do not know your e-mail address, so here I am.  

I advise you to change the e-mail address in the profile setting in EE, so that you can get your notifications promptly.  

Thanks.

Sy@SCI
0
ysimonAuthor Commented:
In Delphi 4, it doesn't work. Anyone knows?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

rwilson032697Commented:
Well, you could also try:

Select * From User Order by User."User IO"

or

Select * From User Order by User.[User ID]   The access way!

Cheers,

Raymond
0
SuperSyCommented:
Simon;

We are getting a notification e-mail about "comment added" from EE for <YSun@sci-s.com>, and I assume you are not getting the notification because of this.  

I personally want to forward the notifications to you, but alas I do not know your e-mail address, so here I am.  

I advise you to change the e-mail address in the profile setting in EE, so that you can get your notifications promptly.  

If there is nothing you can do from your side, we can try to talk with the EE administration to find out why this is happening.  I at least hope you are getting the notification in a timely fashion.

Sincerely,


SuperSy
SYamaguchi@SCI-s.com

0
TalkingDogCommented:
You can refer to a field with spaces (or a fieldname which is a reserved word) like this: Select [Nick Name] from ...
0
TalkingDogCommented:
TalkingDog changed the proposed answer to a comment
0
simonetCommented:
>Select * From User Order by User.[User ID]  

That also works with SQL Server. Once more, Microsoft introduces its own standards! Why don't they use " " like everybody else?

Alex
0
AttarSoftwareCommented:
Heh, you can call the DB to get back the delimiters with an SQL call (I will look it up for you if you need it), but of course, much in the way this thread is going, the call fails with MS Access!!  Woo hoo...  Sooooooo...  what you can do, is try the call, and if it fails, then use '[' and ']', as you know (or pretty much guess) that you are on access... ;O)

Tim.
0
ysimonAuthor Commented:
[User ID] doesn't work. I am using Standard DB in Delphi 4. It is Paradox 7. Why it doesn't accept [User ID]and "User ID"?
0
ysimonAuthor Commented:
Adjusted points to 100
0
hubdogCommented:
because user is a reserved word of local sql,so you get the error message,change user.db to other name such as demo.db, then you can write sql like this
SELECT  Demo."user io" FROM  "demo.db" Demo
it will ok

good luck
hubdog
0
Ronald BusterOwnerCommented:
Hi simon,

try this

Select * From User
Order by "User ID"


regards,

cono




0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.