Link to home
Start Free TrialLog in
Avatar of Cotton
Cotton

asked on

Query to extract numbers from text string

Hi Experts,

Need a bit of quick help.
I have a  table with [ID], [Date], [ClientID],[reference]

Some of the records have a series of numbers in the [reference] field  eg. 10215, 10555, 10331

I'm want to make a query to create a new table with these numbers extracted with their own record each, but I need help of on the extraction part :)

Thanks in advance
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

where are the numbers located

if the numbers are located in front  12345abj

val("12345abj")  will give you  12345


if anywhere else , you will need a function
also you can use the functions  left,mid, right and instr, instrrev depending on the format of the string
post sample data.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cotton
Cotton

ASKER

Super quick response.
For clarificaion:
The [Reference] data in each field is generally "12345", but the ones I need to extract are "10155, 10211, 10255" and ignore the records with text in the record.

I'm just going to try out your function.

Cheers