Could someone show me some TSQL to use to query an xml file as if it were a table?
The file is on the server, \"C:\\xmlfile.xml\"
And contains
&l
In my case - the data I was interested in was contained in the node attributes rather than values. Below includes an example of how the attributes can be accessed.
DECLARE @xmlData XML
set @xmlData='
'
SELECT
ref.value('@FilterID', 'int') AS FilterID ,
ref.value('@Name', 'NVARCHAR (10)') AS Name ,
ref.value('@Code', 'NVARCHAR (10)') AS Code ,
ref.value('@Department', 'NVARCHAR (3)') AS Department,
ref.value('@Number', 'int') AS Number
FROM @xmlData.nodes('/ArrayOfSpangemansFilter/SpangemansFilter')
xmlData( ref )