Skip to content
Advertisement

how to read a XML string value with leading space in sql server

I want to store the value of userId as " XYZ" but when after executing the below code got output as "XYZ". Want to store the value with leading space.

Advertisement

Answer

You may try to parse the input XML using a variable of XML data type and a combination of nodes() and value() methods:

Using this approach you may parse more complex XML data and get userId‘s as rows in a table:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement