In SQL Server, can multiple inserts be replaced with a single insert that takes an XML parameter?

Posted by Mayo on Stack Overflow See other posts from Stack Overflow or by Mayo
Published on 2010-04-28T13:28:39Z Indexed on 2010/04/28 13:33 UTC
Read the original article Hit count: 222

Filed under:
|
|

So I have an existing ASP.NET solution that uses LINQ-to-SQL to insert data into SQL Server (5 tables, 110k records total). I had read in the past that XML could be passed as a parameter to SQL Server but my google searches turn up results that store the XML directly into a table. I would rather take that XML parameter and insert the nodes as records.

Is this possible? How is it done (i.e. how is the XML parameter used to insert records in T-SQL, how should the XML be formatted)?

Note: I'm researching other options like SQL bulk copy and I know that SSIS would be a good alternative. I want to know if this XML approach is feasible.

© Stack Overflow or respective owner

Related posts about sql-server-2008

Related posts about Xml