split field by a - Character

rkrause

Registered User.
Local time
Today, 04:43
Joined
Sep 7, 2007
Messages
343
I have a field in my sql db that is called trucklog. This field has truck number and seal number seperated by a - sign.

so example for a field is
123-123546
55555-44114

there is no definate number of characters before and after the - sign. what i want to do in my query is make these 2 seperate fields. any help would be great.
 
You can use

for the left:

MyNewFieldName:Left([FieldNameHere], Len([FieldNameHere])-Instr(1,[FieldNameHere],"-"))-1

And for the right

MyNewRight:Mid([FieldName], 1,Instr(1, [FieldNameHere], "-"))
 
I need it for sql server, i belive what you laid out was for access?
 

Users who are viewing this thread

Back
Top Bottom