0

I am new to scripting and i cant seem to find the answer to this. I wrote a simple batch script to run a sql query and save the output as a .txt file. However, the results contain double byte characters (for Japanese data) which are being converted to question marks in the output.

This is the line in the script - I am hoping there is an easy answer (ie. adding some formatting code to the end of this line)?

sqlcmd  -E -Smyservername -h-1 -iCust.sql -o Cust.txt

Thanks in advance

Kiril
  • 2,935
  • 1
  • 33
  • 41
Rachael
  • 1
  • 1
  • The output file's encoding is determined by sqlcmd.exe. – Bill_Stewart Sep 02 '14 at 15:52
  • im sorry but can you provide more information? i am very new to this and dont know where or how to set the encoding. – Rachael Sep 02 '14 at 16:25
  • Please read [sqlcmd Utility](http://msdn.microsoft.com/en-us/library/ms162773.aspx) documentation and especially the section __Input/Output Options__ with details for input and output [character encoding](http://en.wikipedia.org/wiki/Character_encoding). With using additionally the switch `-f 1252` you should get `Cust.txt` with codepage Windows-1252 which is the standard for North American and Western European countries for non Unicode text files. – Mofi Sep 02 '14 at 17:00

0 Answers0