I need each param parsed out of this string. I am having trouble parsing if the vars vary in length.
Data: ec=TTT&oc=CRM&tot=501&UID=88997
Exams Passed: 70-152, 70-175, 70-176, 70-100
Data: ec=TTT&oc=CRM&tot=501&UID=88997
Code:
(SELECT
ID, IP, TID, TheUserDetails.UserID as UserID,
--Parsing
Querystring,
SUBSTRING(Querystring, CHARINDEX('ec=',Querystring) + 3, CHARINDEX('&', Querystring) - 4) as EC,
SUBSTRING(Querystring, CHARINDEX('oc=',Querystring) + 3, CHARINDEX('&', Querystring) - 4) as OC,
SUBSTRING(Querystring, CHARINDEX('tot=',Querystring) + 4, CHARINDEX('&', Querystring) - 5) as TOT,
SUBSTRING(Querystring, CHARINDEX('uid=',Querystring) + 4, 50) as UID
FROM WebLog l LEFT JOIN
dbo.TheUserDetails ON
l.TID = TheUserDetails.TrackID)
Exams Passed: 70-152, 70-175, 70-176, 70-100