I am trying to import an xml file into the sql server with no success yet.
The xml file is structured like this:
<Users xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<User>
<PartitionKey>be-BY</PartitionKey>
</User>
</Users>
I am using the following code:
SELECT
xmldata.value('(PartitionKey)[1]', 'NCHAR(10)') AS 'partition_key'
FROM
(SELECT CAST(x AS XML)
FROM OPENROWSET(
BULK 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\SkillageXML\userstest1111.xml',
SINGLE_BLOB
)
AS T(x)
) AS T(x)
CROSS APPLY
x.nodes('/Users/User') AS X(xmldata);
However, I don't see any value after it is done with processing the file. Is there anything missing?