View Full Version : Can some1 help me?


Skerdi
11-06-2007, 03:40 AM
Hi, I need help.
I have a text field and I have the text separated by a ";" . There are only 2 of ";".
There is a sigle word first, then comes a ";", there is another single word and there is the second ";". Then comes a free text (2-3 words).
eg. : alpha;gama;sql server query system
Can someone tell me how to get the first word, how to get the second word and how to get the rest? Or better, to have a result like this :

Name Code Long Name
Alpha gama sql server qyery system

I know how to get the first one using Left([field];InStr([field];";")-1), but what about the second word and the "all the rest"?

ajetrumpet
11-06-2007, 04:17 AM
This is almost like proving mathematics. :) Try this Skerdi...

Create a query....SELECT Left([yourfield],InStr([yourfield],";")-1) AS NewField1,

Mid([yourfield],(Len([NewField1])+2),(InStr((Len([NewField1])+2),[yourfield],";")-
(Len([NewField1])+2))) AS [NewField2],

Right([yourfield],(Len([yourfield])-((Len([NewField1])+Len([NewField2])+2)))) AS [NewField3]

FROM yourtable;

Skerdi
11-06-2007, 05:49 AM
That's it. Thanks so much Adam :)

ajetrumpet
11-06-2007, 07:51 AM
Welcome, Good Luck to you. :)