I have a semi colon delimited string variable in my stored procedure with contents shown in quotes below with a phrase and name separated by two dashes "--".
String Variable below.
Outside Hire--Hire #01; Reassignment - External--Hire #15; Reassignment - External--Hire #21; Outside Hire--Hire #03; Internal Reassignment--John Pen; Outside Hire--Kara Emma
I would like to parse it out such that it shows the names associated with each phrase in brackets, separated by a comma and the number of times the phrase occurs. Example of result is displayed below.
Result
3 Outside Hire(Hire #01, Hire #03, Kara Emma); 2 Reassignment - External(Hire #15, Hire #21); 1 Internal Reassignment(John Pen)