I'm trying to extract xml metadata from from SQL Server's Report Server Database. My current query is listed below:
SELECT
a.Name as 'ReportName'
,a.ReportXML
,Parameter = x.value('(Parameter/Name)[1]','VARCHAR(250)')
FROM (SELECT C.Name,c.itemID,CONVERT(XML,CONVERT(VARCHAR(MAX),C.Parameter)) AS reportXML
FROM ReportServer.dbo.Catalog C
WHERE C.Content is not null
and c.Type = 2 -- Report only
) a
cross apply reportXML.nodes('/Parameters') r (x)
WHERE 1=1
and name ='ReportName'
My objective is to return all parameters associated with a report. The x.value method will only return 1 value at most. (It currently returns the first parameter of the report because 1 is hard coded in the string literal.) I know there are 5 parameters for the report I'm looking at.
Is there another function with similar syntax that will allow me to return all the values? Or is there a wildcard that I can use in place of the number? I've tried multiple functions on msdn with no luck.