Number only

P

Prav

Hi I have the following records in my table:-

PTR22334
AA0123
HDA/C001
'
E/Y001
FG
Z12345
000000123456
000078910112

How can my query return only 123456 & 78910112 only.
 
L

louisjohnphillips

Hi I have the following records in my table:-

PTR22334
AA0123
HDA/C001
'
E/Y001
FG
Z12345
000000123456
000078910112

How can my query return only 123456 & 78910112 only.

Am I missing the point?

SELECT DesiredField
from MyTable
where left( DesiredField,1) = '0'

or

SELECT DesiredField
from MyTable
where left( DesiredField,4) = '0000'

If leading zeroes are to be eliminated

SELECT CInt( DesiredField )
from MyTable
where left( DesiredField,1) = '0'
 
P

Prav

Cheers

Am I missing the point?

SELECT DesiredField
from MyTable
where left( DesiredField,1) = '0'

or

SELECT DesiredField
from MyTable
where left( DesiredField,4) = '0000'

If leading zeroes are to be eliminated

SELECT CInt( DesiredField )
from MyTable
where left( DesiredField,1) = '0'
 
J

John W. Vinson

Hi I have the following records in my table:-

PTR22334
AA0123
HDA/C001
'
E/Y001
FG
Z12345
000000123456
000078910112

How can my query return only 123456 & 78910112 only.

As an alternative which doesn't depend on leading zeros, use a calculated
field

IsNumeric([fieldname])

with a criterion of True.

The only "gotcha" I can think of is that numbers in scientific notation such
as 3105E2 or 1154D28 will be seen as numeric.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top