views:

53

answers:

1

Scenario

I've got an application written in C# that needs to dump some data every minute to a database. Because its not me that has written the spec, I have been told to store the data as XML in the SQL Server database and NOT TO USE the "bulk upload" feature. Essentially I just wanted to have a single stored procedure that would take XML (that I would produce from my datatable) and insert it into the database.....and do this every minute.

Current Situation

I've heard about the use of "Sp_xml_preparedocument" but I'm struggling to understand most of the examples that I've seen (My XML is far narrower than my C Sharp ability).

Question

I would really appreciate someone either pointing me in the direction of a worthwhile tutorial or helping explain things.

EDIT - Using (SQL Server 2005)

+1  A: 

In SQL Server 2005, there is an XML datatype. It's worth having a read of this MSDN overview of XML support in SQL Server 2005.

You can pass an XML variable into (e.g.) a stored procedure very easily, and the data within it can be easily queried. Have at look at this article with examples.

AdaTheDev