April 8, 2011 at 9:17 am
Hello All
Sql Server 2008 SP 2:
We have a table abc_xml which has def_xml col with varbinary in which we are storing .xml files
we use the below command to extact the .xml file using bcp
declare @cmd varchar(8000)
Set @cmd ='bcp "select cast(def_xml as varchar(2000)) from abc_xml" queryout d:\ppt.xml -t -w -r "" -S Abasha -U xxx -P xxx'
PRint @cmd
exec master..xp_cmdshell @cmd
we are able to genrate th xml file.
But when we try to open the .xml file in browser we are gettin the below error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
Switch from current encoding to specified encoding not supported. Error processing resource 'file:///D:/ppt.xml'. Line 1, ...
<?xml version="1.0" encoding="utf-8"?>
Please suggest how to solve.
Thnaks in advance
April 8, 2011 at 10:15 am
I copied the error message "Switch from current encoding to specified encoding not supported." into google.
The very first link returned: "You get this error if your XML file was saved as double-byte Unicode (or UTF-16) with a single-byte encoding (Windows-1252, ISO-8859-1, UTF-8) specified."
You're using bcp -w.
As per BOL: -w: Performs the bulk copy operation using Unicode characters.
Seems obvious to me....
April 8, 2011 at 10:21 am
yes... -w didnt work either.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply