SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Disable Unicode output


Disable Unicode output

Author
Message
michael_alawneh
michael_alawneh
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 78
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.
Eirikur Eiriksson
Eirikur Eiriksson
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40815 Visits: 19472
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.
Cool
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (215K reputation)SSC Guru (215K reputation)SSC Guru (215K reputation)SSC Guru (215K reputation)SSC Guru (215K reputation)SSC Guru (215K reputation)SSC Guru (215K reputation)SSC Guru (215K reputation)

Group: General Forum Members
Points: 215879 Visits: 41981
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

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
michael_alawneh
michael_alawneh
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 78
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.
Eirikur Eiriksson
Eirikur Eiriksson
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40815 Visits: 19472
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)')
Cool
michael_alawneh
michael_alawneh
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 78
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.
Eirikur Eiriksson
Eirikur Eiriksson
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40815 Visits: 19472
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.
Cool
Sean Pearce
Sean Pearce
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4066 Visits: 3436
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.





The SQL Guy @ blogspot

@SeanPearceSQL

About Me
Attachments
SSMSSave.png (87 views, 5.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search