Try using the .query() operator instead of .value() - like this:
INSERT INTO UserDetailtbl(RoleXml) SELECT ID.query('.') FROM @UserDetailsXML.nodes('UserDetails/UserDetailsRow/RoleXml') AS Y(ID)
Perhaps this will work, as the .query() operator returns the definition of the XML fragment by definition.
If this does not work, we will need to learn more about your XML structure - can you show us an example of your XML stored in the @UserDetailsXML variable? What part of this do you want to insert into UserDetailTbl.RoleXml ?
source share