Import XML into SQL with Bulk Insert?

  • Hi all,

    Looking at trying to get an XML file imported into a table for manipulation.

    Given this piece from BOL, I have hopes that Bulk Insert in 2005 can handle XML:

    Bulk Exporting or Importing SQLXML Documents

    To bulk export or import SQLXML data, use one of the following data types:

    Data type Effect

    SQLCHAR or SQLVARYCHAR

    The data is sent in the client code page or in the code page implied by the collation). The effect is the same as specifying the DATAFILETYPE = 'char' without specifying a format file.

    SQLNCHAR or SQLNVARCHAR

    The data is sent as Unicode. The effect is the same as specifying the DATAFILETYPE = 'widechar' without specifying a format file.

    SQLBINARY or SQLVARYBIN

    The data is sent without any conversion.

    Am I mistaken? If so, is SSIS the only way to get XML data into a SQL table?

  • This was removed by the editor as SPAM

  • you can use OPENROWSET to load any files into database, e.g.:

    DECLARE @xml xml

    SELECT @xml=CAST(BulkColumn as xml) FROM OPENROWSET(BULK N'C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ProcessXMLData Sample\DataFiles\Orders.xml', SINGLE_BLOB) A

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply