This is a question about how to find all reports that are referencing a column in our database. Said column is currently called label_description and is being split into several new columns. My boss asked me to find all our reports in a certain solution that reference this column. I googled how to do this, and discovered the ReportServer table which is created from the rdl files in the solution and on the server that you deploy to.

I believe I have given my boss the correct answer, but I was hoping to discuss what I tried and why one way worked and one way did not.

The first link I found and tried was this and I changed the query from PatientNumber to label_description, but it returned nothing. Do you see someting I forgot to change or some other mistake?
Code:
DECLARE @FieldToSearch VARCHAR(100)
SELECT @FieldToSearch = 'label_description'

;WITH XMLNAMESPACES (
	DEFAULT 
	'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition',
	'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS rd
)
SELECT
	name,
	d.value('@Name[1]', 'VARCHAR(50)') AS DataSetName,
	df.value('@Name[1]', 'VARCHAR(50)') AS ReportFieldName,
	df.value('DataField[1]', 'VARCHAR(50)') AS DataFieldName
FROM (
	select name, 
	CAST(CAST(content AS VARBINARY(MAX)) AS XML) AS reportXML
	from ReportServer.dbo.Catalog
	WHERE Type = 2
) a
CROSS APPLY reportXML.nodes('/Report/DataSets/DataSet') r(d)
CROSS APPLY d.nodes('Fields/Field') f(df)
WHERE df.exist('DataField[ . = sql:variable("@FieldToSearch")]') = 1
/*
Name          DataSetName   ReportFieldName  DataFieldName
------------  ------------  ---------------  ---------------
Patient List  DSPatients    PatientID        PatientNumber
AR Details    DSPatientsAR  PatientNumber    PatientNumber
*/
The second hit in google was this and that returned me 28 reports. I checked the first and it references label_description in a query. I checked the second and it references label_description in a stored procedure. So that looks to me like it finding both kinds of datasets in my reports.
Code:
SELECT [name]								
FROM reportserver.dbo.catalog								
WHERE CONVERT(varchar(max), CONVERT(varbinary(max), content)) LIKE '%label_description%'
Do you agree that I am using the best query to get the information I need, and that I won't miss any reports? Thanks.