thebluestar 0 Junior Poster in Training

I have tried to upload the xml file into a column with xml type of the database table
I use sql statement like:

USE xml_tbl
go
INSERT INTO xml_tbl(Filename,DATA)
SELECT 'file1' a,*
FROM OPENROWSET( BULK 'C:\XML\file1.xml' ,SINGLE_CLOB)
as a

or into the existing column:

update tbl_xml
set data = (select * from openrowset (BULK 'C:\XML\file1.xml' ,SINGLE_CLOB) as x)
where Filename ='test'

but both of them raised an error "Msg 9438, Level 16, State 1, Line 1
XML parsing: line 2, character 6, text/xmldecl not at the beginning of input"
.
I don't know why?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.