Insert data from XML file to SQL Database

  • Thread starter Thread starter Dray
  • Start date Start date
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
 
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.
 
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...
 
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...
 
Back
Top