Insert data from XML file to SQL Database

D

Dray

Hi,

Could anyone please give me a code example of how to insert data from
an XML file into a SQL database. So far I've got the data sitting in a
dataset...

Thanks
 
S

sloan

Sql Server 2000 , OPENXML. Send the xml in as text (one way).
ds.GetXml() will work.

Sql Server 2005? SP2 introduced an slowness bug.
http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=250407

You'll have to consider sending in your ds.GetXml ..but convert it to
attribute based first.


Helper articles:
http://sholliday.spaces.live.com/blog/cns!A68482B9628A842A!148.entry
http://www.sqlservercentral.com/articles/Stored+Procedures/thezerotonparameterproblem/2283/
http://www.ipass.net/sloan/code/OPENXML_vs_SQL2005Syntax_Test.txt

Good luck.
 
D

Dray

Sql Server 2000 , OPENXML.  Send the xml in as text (one way).
ds.GetXml() will work.

Sql Server 2005?  SP2 introduced an slowness bug.http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?Fee...

You'll have to consider sending in your ds.GetXml ..but convert it to
attribute based first.

Helper articles:http://sholliday.spaces.live.com/bl.../sloan/code/OPENXML_vs_SQL2005Syntax_Test.txt

Good luck.








- Show quoted text -

Hi, thanks for your help. I was however thinking of using sqldataapter
update to do this but are not sure how to go about it...
 
S

sloan

I think you're barking up the wrong tree, but that's me.

SqlDataAdapters have a very "row by row"-ness to them.

If you want the "set based" or "bulk-ness" of xml, I think you'll have to do
some coding.

Here is one last helper article:
http://support.microsoft.com/kb/315968

........




Sql Server 2000 , OPENXML. Send the xml in as text (one way).
ds.GetXml() will work.

Sql Server 2005? SP2 introduced an slowness
bug.http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?Fee...

You'll have to consider sending in your ds.GetXml ..but convert it to
attribute based first.

Helper
articles:http://sholliday.spaces.live.com/bl.../sloan/code/OPENXML_vs_SQL2005Syntax_Test.txt

Good luck.








- Show quoted text -

Hi, thanks for your help. I was however thinking of using sqldataapter
update to do this but are not sure how to go about it...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top