You are here: isql / osql / Windows XP / disable "Automatic ANSI to OEM conversion" « MsSQL Server « IT news, forums, messages
isql / osql / Windows XP / disable "Automatic ANSI to OEM conversion"

Posted by Philip Bondi on 01/13/06 22:32

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация