I have 2 tables as follows on Sql Server 2005 database
Request(RequestId int, Filter xml)
DataTable(Id int,.....)
The filter column has a list of ids from datatable as xml for e.g. 1013
Now I want to select the data from DataTable that match the ids in the filter xml. Here is what I have come up with
select d.*
from request
cross apply filter.nodes('Ids/Id') as Ids(id)
inner join DataTable d on d.id = Ids.Id.value('.', 'int')
where requestid = 35
This works but I want to know if this is the best way to do this.