I have a table which looks like the following:
EventProfileID    ParamName       ParamValue
1                 _CommandText    usp_storedproc_1
2                 _CommandText    usp_storedproc_2
2                 _CommandText    usp_storedproc_3
2                 _CommandText    usp_storedproc_100
3                 _CommandText    usp_storedproc_11
3                 _CommandText    usp_storedproc_123
What I would like my output to be is the following:
EventProfileID    ParamValue
1                 usp_storedproc_1
2                 usp_storedproc_2, usp_storedproc_3, usp_storedproc_100
3                 usp_storedproc_11, usp_storedproc_123
However I am having some bother. If I do a select on one of the event profile ID's I can get an output using the following logic:
SELECT LEFT(c.ParamValue, LEN(c.ParamValue) - 1)
FROM (
SELECT a.ParamValue + ', '
FROM DP_EventProfileParams AS a
WHERE a.ParamName = '_CommandText'
and a.EventProfileId = '13311'
FOR XML PATH ('')
) c (paramvalue)
However that just gives me the output for one EventProfileID and also I would like the EventProfileID as part of the output.
Can anyone give me any pointers in the right direction into how I can expand my code to include this and allow the code to be dynamic so that I can show all EventProfileID's?
Thanks
 
     
    