Good day. I need to import the XML file in Russian into SQL.

XML example:

<data_exchange data_type="документы" config_name="Магазин" date_creation="2012-08-15" time_creation="18:14:57"> <goods_item> ...some data... </goods_item> </data_exchange> 

SQL query:

 declare @insert nvarchar(4000), @pathname varchar(200), @xml xml set @pathname = 'file_path' create table #tmp_xml(xmldata xml) set @insert = 'INSERT INTO #tmp_xml(xmldata) SELECT bulkcolumn FROM OPENROWSET (BULK N''' + @pathname+ ''', SINGLE_BLOB) AS data' exec sp_executesql @insert select @xml = xmldata from #tmp_xml INSERT INTO store_XML_import SELECT Tbl.Col.value('my_data', 'type'), FROM @xml.nodes('/data_exchange/goods_item') Tbl(Col) drop table #tmp_xml 

The analyzer generates an error on 27 characters of 1 line - the letter "d". In XML, I specified encodings:

 <?xml version="1.0" encoding="UTF-8" ?> 

I tried Windows-1251, the same thing. How to fix it?

    1 answer 1

    <?xml version="1.0" encoding="UTF-8" ?> means that the XML encoding itself must be UTF-8. Most likely, your file encoding does not match the declared encoding - that's why the parser curses