Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to strip string based on criteria between commas

Status
Not open for further replies.

LikeThisName

Vendor
May 16, 2002
288
US
i have a string that will look like this:
INSERT INTO insiteCROMO.dbo.PGW_estim (UserID, Date1, WLoad, Nickname) VALUES ('DelorA', 'Jul 3 2004',60, 'TEST NEW REF')

i need to create an integer that return in the case above 60. the integer will always be 5-100 and it will always be between the 5th and 6th comma in the sql string.

so would i return the position in the string where the 5th comma is and and 6th comma is then get use the mid function to get my integer?

or is it better to split string into 7 strings by a deliminator "," and then my integer will always be in the sixth string?

any advice helpful thanks

LikeThisName <- ? Sorry It's Taken =)
 
I would opt for using the Split function (A2K +) with ',' as the delimiter and referencing the proper array element.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Have you tried this ?
myInt = Split(myStr, ",")(5)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top