0

Hi I have a XML file like this

<pictures>
<mainimg>
<link>http://s.freshnewtracks.com/wp-content/uploads/2012/07/dr_dre_20011.jpeg</link>
</mainimg>
<img>
<title>back</title>
<link>http://s.freshnewtracks.com/wp-content/uploads/2012/07/dr_dre_20011.jpeg</link>
</img>
<web></web>
<twitter></twitter>
<facebook></facebook>
<myspace></myspace>
<about></about>
</pictures>

I need to INSERT this XML into a SQL Datatable without using XML file on disk. I have seen other examples where it is done by using a xml file on disk. I want to do this with typed/string XML without saving to disk/BULK Link For eg something like

INSERT INTO Table (XMLColumn)
VALUES (XML LIKE STRING)

Is this possible? Can I have some controls over the elements of XML file for each row?

1

1 Answer 1

1

Pass this XML as string to stored procedure and get this xml string by @XML XML = null in the stored procedure

In the SP:

insert into Table(column_name) 
                                      SELECT 
         @Applicationo_new
            ,column_name  = t.p.value('column_name', 'varchar(20)') 
    FROM @XML.nodes('pictures') t(p);
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.