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

Select using a protected word

Status
Not open for further replies.

marcela24

Programmer
Feb 17, 2003
72
0
0
NL
I have a table that has a column called "status". I'm trying to select some fields of my DBF table through the Foxpro software. My select is something like this:

SELECT * FROM TABLE WHERE STATUS = ""

But I've noticed that it is returning all status situation. Maybe it's because "status" is a protected word in foxpro, but I don´t know what to do. Can somebody help me?

Thanks,
Marcela.
 
Hi,

Yes, status is a reserved word, but I think that is not the reason why your query is returning all the records. Try the following:

SELECT * FROM TABLE WHERE STATUS = " " && instead of ""
or
SELECT * FROM TABLE WHERE ISBLANK(STATUS)
 
I have incorporated many queries which use field names such as Status into applications and they work fine.

If you have any questions about its working, you can always change the WHERE parameter to TABLE.STATUS which will make it absolutely different than any other STATUS.

As TheRambler suggests, it is not the reason that your SELECT - SQL query fails.

A double set of quote marks with no space between is often interpreted by FP different than you think. To be safe, follow TheRambler's suggestions or even
SELECT * FROM TABLE WHERE EMPTY(STATUS)

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
moreso, to add sir jrb's suggestion, you could use
Code:
SELECT * FROM TABLE WHERE EMPTY(ALLTRIM(STATUS))
to include field STATUS containing space(s) only.

hope this helps. peace! [peace]

kilroy [trooper]
philippines

"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get one million miles to the gallon, and explode once a year, killing everyone inside."
 
Marcelo,
do you have
set exact on ?
If not, i recommend set it, to prevent "" equal any string.
Tesar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top