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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing a really long catchall log string

Status
Not open for further replies.

BHScripter

Technical User
Aug 26, 2002
159
US
Hi:

I have a column which I need to parse out one value from a really long string. The column contains log file information which holds information regarding when a table receives an insert statement. The string looks like the string below just a lot longer. I need the value that says "testvend". It should always be the second item in the VALUES parantheses group.

Sample of log entry in column:
INSERT INTO Sample(HPerson, UCODE, ULASTNAME) VALUES ( 921582, 'testvend', 'Test')

thanks for any help in advance.
 
Find the value 'VALUES' and get the string following the VALUES
E.g.
(921582, 'testvend', 'Test')

Then you need to get a string between two commas.

So, do your work in steps using substring and charindex functions.

PluralSight Learning Library
 
If all your data looks like that just use charindex to find the first and second sigle quote and substring to get everything between.

Simi
 
Found the first single quote and then used substring. Thank you!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top