By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,466 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,466 IT Pros & Developers. It's quick & easy.

isql / osql / Windows XP / disable "Automatic ANSI to OEM conversion"

P: n/a
Hello to all SQL Server junkies who work with non-English characters:

For people running scripts from the command line using ANSI files with
special characters, it is very important to use isql and disable
"Automatic ANSI to OEM conversion":
- This only affects isql from the command line, and no gui
applications
- http://support.microsoft.com/?scid=kb;EN-US;153449
- Start the "Client Network Utility"
C:\WINDOWS\system32\cliconfg.exe
- Select the DB-Library Tab
- Deselect "Automatic ANSI to OEM conversion"
- Click OK or Apply

Or inject this registry entry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ Client\DB-Lib]
"AutoAnsiToOem"="OFF"

Here are some useful lines from a batch script to query the current
value of the registry and reset if necessary. This is tested on
Windows XP. It will query the registry, throw away the first three
lines of output, and return the value of the third field on the fourth
line. Delims lists one tab character and one space character. Type the
following all on one line:

@FOR /F "SKIP=3 TOKENS=3 DELIMS= " %%A IN ('REG QUERY
HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\DB-Lib /v AutoAnsiToOem') DO
@SET AUTOANSITOOEM=%%A

Type the "reg add" line all on one line:

@IF /i "%AUTOANSITOOEM%" EQU "ON" (
@ECHO
************************************************** **********************
@ECHO ****
@ECHO **** We need to disable "Automatic ANSI to OEM conversion"
@ECHO **** Please see
http://support.microsoft.com/?scid=kb;EN-US;153449
@ECHO **** This only affects isql from the command line
@ECHO ****
@ECHO
************************************************** **********************
@REM
REG ADD HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\DB-Lib /v
AutoAnsiToOem /t REG_SZ /d OFF
)

Alternatively, you must use Unicode script files and osql.

PS: Thank you to Erland Sommarskog for http://www.sommarskog.se and Rob
van der Woude for http://www.robvanderwoude.com

Jan 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Within the FOR command use SKIP=2 on Windows Server 2003

Philip Bondi wrote:
Hello to all SQL Server junkies who work with non-English characters:

For people running scripts from the command line using ANSI files with
special characters, it is very important to use isql and disable
"Automatic ANSI to OEM conversion":
- This only affects isql from the command line, and no gui
applications
- http://support.microsoft.com/?scid=kb;EN-US;153449
- Start the "Client Network Utility"
C:\WINDOWS\system32\cliconfg.exe
- Select the DB-Library Tab
- Deselect "Automatic ANSI to OEM conversion"
- Click OK or Apply

Or inject this registry entry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ Client\DB-Lib]
"AutoAnsiToOem"="OFF"

Here are some useful lines from a batch script to query the current
value of the registry and reset if necessary. This is tested on
Windows XP. It will query the registry, throw away the first three
lines of output, and return the value of the third field on the fourth
line. Delims lists one tab character and one space character. Type the
following all on one line:

@FOR /F "SKIP=3 TOKENS=3 DELIMS= " %%A IN ('REG QUERY
HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\DB-Lib /v AutoAnsiToOem') DO
@SET AUTOANSITOOEM=%%A

Type the "reg add" line all on one line:

@IF /i "%AUTOANSITOOEM%" EQU "ON" (
@ECHO
************************************************** **********************
@ECHO ****
@ECHO **** We need to disable "Automatic ANSI to OEM conversion"
@ECHO **** Please see
http://support.microsoft.com/?scid=kb;EN-US;153449
@ECHO **** This only affects isql from the command line
@ECHO ****
@ECHO
************************************************** **********************
@REM
REG ADD HKLM\SOFTWARE\Microsoft\MSSQLServer\Client\DB-Lib /v
AutoAnsiToOem /t REG_SZ /d OFF
)

Alternatively, you must use Unicode script files and osql.

PS: Thank you to Erland Sommarskog for http://www.sommarskog.se and Rob
van der Woude for http://www.robvanderwoude.com


Jan 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.