August 2, 2010 at 7:50 am
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 ?
August 3, 2010 at 4:20 am
Anyone ?
August 3, 2010 at 5:02 am
OK, I guess no one can help me
August 3, 2010 at 5:18 am
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.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply