Re: Inserting into SQL via XML using OLEDB Consumer Templates ?



Heiko (heiko_dev@xxxxxxxxxx) writes:
> Has anyone got a sample or some links on how to insert data into SQL
> Server via XML ?

The topic on OPENXML in Books Online should take you a long way.
Else have a look at http://www.sqlxml.org/.

> Only saw samples to retrieve XML up to now.
>
> - Ideally I would like to create the XML insert statements in memory,
> not reference an external xml command file.
>
> - If we need to insert between 10 to 10000 rows of data into SQL Server
> table, what options are available to do this from Visual C++ ?
> (Currently we use OLE DB Consumer Templates implementation that calls
> a stored proc for each row insert. )
>
> Is it correct to assume that inserting 3000 rows via XML would be faster
> (one call) than doing 3000 stored proc calls ?

Yes, that's a definite winner. We have several places in our app,
where insert data from a grid page or similar. We used to that one
by one, now a lot of that uses OPENXML for improved performance.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
.



Relevant Pages

  • Is FOR XML EXPLICIT still an accepted technique?
    ... I have inherited an ASP IIS site attached to a SQL ... Server 2000 database. ... I am new at using XML and have done considerable reading. ...
    (microsoft.public.sqlserver.xml)
  • Re: openxml - streams the xml or loads it all in to memory?
    ... OpenXML does load it into its memory (although it will be using the SQL ... Server buffer and does has some disk backing). ... SQLXML 3.0 XML Bulkload facility. ...
    (microsoft.public.sqlserver.xml)
  • Re: Dataset or SqlCommand or SQLXML
    ... you can do it using the WriteXml method of a ... of SqlCommand - and this will only work with a FOR XML query against SQL ... Server 2000 - so you couldn't use this approach with other data sources. ... quite a few advantages to using the SqlXml classes if your data is in SQL ...
    (microsoft.public.sqlserver.xml)
  • Re: XML-Speicherung beim SQL Server 2005
    ... > also wenn die XML-Dokumente geparst werden, ... das der SQL Server dafür XQuery einsetzt. ... Struktur von XML. ...
    (microsoft.public.de.sqlserver)
  • Re: Help, Transferring XML data under SSL
    ... I hope that you are using SQL 2000 and then you can use the FOR XML things. ... Curl is free for download and it installs like ... The sql server will have curl installed on it. ...
    (microsoft.public.data.xmlanalysis)