reading external xml into a table

  • I have several xml documents and I want to load them into a column on my sql server database, I found some example code which I modified and it seems to work perfectly well. I have a series of xml documents on my file system and have created some code to insert them into my database. There are 13 files in total, so Ive created a sql statement for each file. For some reason, the xml from some of the files isnt going into the table, out of the 13 files, only four of them have the xml column populated (13 records were inserted). heres the code for one of the files that isnt working

    INSERT INTO [File]

    SELECT 0, 'CDL011.xml', 'F:\XML',GetDate(),4,'07/16/2009 00:00:00', '07/16/2009 00:00:00', 24, 24, xCol,'AwaitingProcessing'

    FROM (SELECT *

    FROM OPENROWSET (BULK 'F:\XML\CDL011.xml', SINGLE_CLOB)

    AS xCol) AS R(xCol)

    and the code for one that does work

    INSERT INTO [File]

    SELECT 0, 'CDL0022.xml', 'F:\XML',GetDate(),4,'07/16/2009 00:00:00', '07/16/2009 00:00:00', 3, 3, xCol,'AwaitingProcessing'

    FROM (SELECT *

    FROM OPENROWSET (BULK 'F:\XML\CDL0022.xml', SINGLE_CLOB)

    AS xCol) AS R(xCol)

    GO

    the only real difference is the xml file being read in, yet one works the other doesnt. As I mentioned a row is being created for each file in the directory (13), no errors are generated, but the xml column is empty. Ive opened the problem file manually and cant see anything obviously wrong with it, there seems to be no corruption. How can I find out what the problem is ?

  • Anyone ?

  • OK, I guess no one can help me

  • Well, maybe the information provided so far cannot be used to answer your question...

    Please attach both xml files and provide the DDL script for the [File] table.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

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

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