Insert data from XML file to SQL Database

Dray (archive)

Usenet Archive
Joined
Aug 8, 2008
Messages
4
Reaction score
0
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
 

sloan

Usenet Archive
Joined
Jan 3, 2000
Messages
1,496
Reaction score
0
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.
 

Dray (archive)

Usenet Archive
Joined
Aug 8, 2008
Messages
4
Reaction score
0
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...
 

sloan

Usenet Archive
Joined
Jan 3, 2000
Messages
1,496
Reaction score
0
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

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,246
Members
248,133
Latest member
DujonT

Latest Threads

Top