Question : Extracting a portion of a string

Good morning Experts,

I have an account number formatted as such:
999999999-00001
88888888-00023

The data type for the field is text.

I need to extract the first digits up to but not including the –
So for the first account number I need 999999999
The digits before the dash are of varying length.
For example the first account number has nine digits before the hyphen.
The second account number has eight digits before the account number.
I need to enter this into the expression builder of the query design grid.

Any assistance is greatly appreciated.

Thank you,

Answer : Extracting a portion of a string

Try:

select left(accountnumber,instr(accountnumber,"-")-1) as LeftPArt,..

Clear ?

Nic;o)
Random Solutions  
 
programming4us programming4us