I am using the following code to import an XML file via Sql Server. The XML file is verified to be properly formatted. If I import the entire file the results of the final SQL statement are empty. If I remove half the data in the file it imports fine. I have switched the top and the bottom half of data to rule out a character set issue. It seems to be a size issue? Has anyone had this problem? I can import the file with no issue via SSIS but I would rather use this method. Any help would be greatly appreciated.
CREATE TABLE XmlImportTest
DECLARE @xmlFileName VARCHAR(300)
SELECT @xmlFileName = '\\servername\e$\xml_test\PD_852_387401.xml'
-- dynamic sql is just so we can use @xmlFileName variable in OPENROWSET
INSERT INTO XmlImportTest(xmlFileName, xml_data)
SELECT ''' + @xmlFileName + ''', xmlData
FROM OPENROWSET (BULK ''' + @xmlFileName + ''' , SINGLE_BLOB) AS XMLDATA
) AS FileImport (XMLDATA)
SELECT * FROM XmlImportTest
DROP TABLE XmlImportTest