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

String to Int conversion for SQL with Paradox

Status
Not open for further replies.
Mar 17, 2005
44
US
I have a field in a Paradox table that is stored as an Alphanumeric. It was done this way so that values without a sign, and with signs, both "-" and "+" could be displayed without special code.

Values could be: 1, 5, -2, +3 etc.

Now, it's coming to bite me in the behind.

I have a user of the application who wants to be able to search for values between, say, 1 & 5. So when they do a query:

where skill >= "1" and <= "5"

they are getting values like 10, 11 & 12 returned as valid.

Is there some way to do something like:

Where StrToInt(skill) >= 1 and StrToInt(skill> <= 5 ?

I'm using Delphi 5 Professional with Paradox 7 tables on Windows XP Professional.

Thanks
Steve
 
You can try to format your quantities to have them collated in the right order in ASCII: 001, 002, 003... 010... 020... 100; but you are making things unnecesarilly convoluted.

You are working with numbers, the best solution is using numbers.

buho (A).
 
Unfortunately, since I need to differentiate between a base number like "5" and a modifier of say, "+5", I didn't see any way to do that without going alpha.

If I do numeric fields, they effecively become the same thing.

So, am I totally up the creek then?

Steve
 
Use a type field to differentiate skills from modifiers or use a master-detail table structure for skills and modifiers (the last is the best, IMO, pretty expandable).

Can't say more with the knowledge I have about your problem. Feel free to explain it with more detail.

And drop Paradox, it is dead. Go for ADO.

buho (A).
 
It's a low priority issue, I'll talk to the user and see how big of a deal it is - if it's really worth all that Dev time to get around a very rarely used search.

Thanks
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top