July 28, 2014 at 5:15 pm
I am running SQL Server 2012. I have been producing files as output for the Unix folks at work. We are running into an issue with what appears to be all the files I produce are using Unicode and placing hidden characters in the beginning of files. I am simply using "Results to File" as the option vs going to grid/text.
The data being exported is not in Unicode data types.
When viewed in UltraEdit hex mode I see "0" or "EF BB BF".
The solution I have been using to get around this is taking the file open it in Notepad and do a Save As with Encoding = ANSI from the dropdown.
Any help on just creating the file in ANSI from the get go would help.
Thanks.
July 28, 2014 at 9:38 pm
michael_alawneh (7/28/2014)
I am running SQL Server 2012. I have been producing files as output for the Unix folks at work. We are running into an issue with what appears to be all the files I produce are using Unicode and placing hidden characters in the beginning of files. I am simply using "Results to File" as the option vs going to grid/text.The data being exported is not in Unicode data types.
When viewed in UltraEdit hex mode I see "0" or "EF BB BF".
The solution I have been using to get around this is taking the file open it in Notepad and do a Save As with Encoding = ANSI from the dropdown.
Any help on just creating the file in ANSI from the get go would help.
Thanks.
Quick thought, use the bcp Utility to export the data.
July 29, 2014 at 8:09 pm
michael_alawneh (7/28/2014)
I am running SQL Server 2012. I have been producing files as output for the Unix folks at work. We are running into an issue with what appears to be all the files I produce are using Unicode and placing hidden characters in the beginning of files. I am simply using "Results to File" as the option vs going to grid/text.The data being exported is not in Unicode data types.
When viewed in UltraEdit hex mode I see "0" or "EF BB BF".
The solution I have been using to get around this is taking the file open it in Notepad and do a Save As with Encoding = ANSI from the dropdown.
Any help on just creating the file in ANSI from the get go would help.
Thanks.
Are you saving it as a .rpt file?
--Jeff Moden
Change is inevitable... Change for the better is not.
July 29, 2014 at 8:46 pm
I am saving the results as text (.txt)
I am running from management studio. For a simple result dump I would think using the bcp would be a little over kill, but I'll give it a go.
Thanks all.
July 29, 2014 at 9:59 pm
Quick question, the query used for this wouldn't by any chance have a FOR XML statement in it? What you are seeing there is the UTF-8 BOM or Byte Order Mark. The solution could then simply be changing the query, possibly just adding something like .value('.[1]','VARCHAR(MAX)')
July 29, 2014 at 10:14 pm
None of the queries are XML. Simple selects just outputting as file.
SET NOCOUNT ON
SELECT Blah
, Blah
FROM dbo.tblBlah
If it's a default for the UTF-8 format I'm sure there's a place to change it.
July 29, 2014 at 10:33 pm
michael_alawneh (7/29/2014)
None of the queries are XML. Simple selects just outputting as file.SET NOCOUNT ON
SELECT Blah
, Blah
FROM dbo.tblBlah
If it's a default for the UTF-8 format I'm sure there's a place to change it.
I cannot recall such a setting, at least it is not in the Query Options.
I have tried to reproduce this on my server by using combinations of language settings, server collations, column collation etc. but no luck.
July 30, 2014 at 6:24 am
You cannot specify a default setting but you can specify the encoding when you generate the results.
When you run your query the Save Results window has the option. It is a small black triangle which is part of the Save button. This will allow you to specify encoding for your file.
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy