Having data in the for of XML and I want to store that XML in a SQL Server table. I have created a column of datatype xml
and tried to store my XML data in that newly created column, but I get an error on INSERT
:
The data type 'xml' used in the VALUE method is invalid.
This is the Insert
statement:
INSERT INTO UserDeatailtbl(RoleXml)
SELECT Y.ID.value('./RoleXml[1]', 'XML')
FROM @UserDetailsXML.nodes('UserDetails/UserDetailsRow') AS Y(ID)
<UserDetailsRow>
nodes and you try to create one row per each. Wild guess: You do not want to store the XML as XML but rather want to read the included values into your table's columns? Please state the import (your XML) and the expected result. – ShnugoRoleXml
? What does outer XML mean? What does storing in table mean? If @marc_s answer does not help you out, please provide more details... – Shnugo