3

I have a list of strings as:

    List<string> list = new List<string>();
    list.Add("912-123898493");
    list.Add("021-36574864");
    list.Add("021-36513264");

I want to convert it in XML and then send it as a parameter to Stored procedure, so that this could be read.

How to read this XML in sql server so that each and every string can be placed in different cell? Please help!!

1
  • You changed your question from "convert it to XML" to "convert it in XML". What do you mean by "covert in XML"? Commented Oct 15, 2012 at 16:44

1 Answer 1

5

It depends of what structure your xml will have. Here's example of how you can read elements xml:

declare @Data xml

select @Data = '
<root>
    <value>912-123898493</value>
    <value>021-36574864</value>
    <value>021-36513264</value>
</root>'

select T.C.value('data(.)', 'nvarchar(128)') as [Data]
from @Data.nodes('/root/value') as T(C)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.