The big picture is that I'm trying to query SQL report server execution logs to create a nice readable report of who used which reports and what parameters they used in each. The problem is that the parameters columns is just a long string.
So the more specific question I'm posing is what is the best way to take this string (example below) and parse everything before each ampersand into a new column?
Example string (So for this example string, I'd want new columns for: StartDate, EndDate, Program, Location, Status, Name):
StartDate=3%2F1%2F2021%2012%3A00%3A00%20AM&EndDate=3%2F31%2F2021%2012%3A00%3A00%20AM&Program=PRGRM1&Location=VN-South%20Main%20St&Status=Active&Name=Smith%2C%20Bob%20
And here's what I'm trying currently, but it's not really doing what I need, and I suspect I'm going down the wrong path here:
SELECT
RTRIM(Substring(Parameters, CHARINDEX('&program=',Parameters, 1) + 9, 100)) as 'Program'
Any help is much appreciated... I'm just getting started with SQL and can't figure out how to best tackle this.