Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I'm no expert when it comes to SQL, so go easy on me. I'm a novice.
Here's the situation: My VB6 code is constructing an SQL query string which will eventually be passed to my Access DB. There is a field in the DB which is text, but which also contains numeric values. Here are some examples of data strings that might be in this field:
0
5
11
X
N/A
I want to be able to search the purely numeric values in this field using logical numeric operators ( i.e. <, <=, >, >=, and = ), but I don't want other non-purely-numeric values returned.So, if my query was something like
blah blah blah WHERE fieldA > 3
it would return the record with the 5 in fieldA, and none of the others from the above group, in the result set.
How do I do it?!
Any help is much appeciated.

Oops. I would want that query to return 11 as well. The problem is that as a string, the 11 isn't returned, since alphabetically, it's lower than 5.

You can use the following query
select * from t1 where val(id)>3 and isnumeric(id)=true
Val-converts them to numerics. Numeric is used to check for purely numerics.
For Eg.5,11,15adfb
It will return only 5 & 11.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |