OSQL -i AND script's code page

  • Hello Everyone,

    We plan to change our console code page to 1252 shortly.

    We are in the process of analyzing the impact of this move.

    I noticed that when we change the value for HKLM-> System -> CurrentControlSet -> CONTROL -> NLS -> Codepage -> OEMCP from 850 to 1252, the utility BCP behaves well (good character conversions between the client and the server in both directions).

    This is not the case for osql. Osql still assume that the script it execute is encoded with code page 850. Where does OSQL read this value?

    Best regards.

    Carl

  • Hey Carl,

    Have you looked into SQLCMD? Maybe that can solve your issues, since it was shipped with SQL2K5. And I only use that I haven't had need to go back to OSQL.

    Thanks.

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • Hello Mohit,

    Yes I know that sqlcmd offers a lot more flexibility for that purpose but we are stuck with old SQL Server versions and, in the same time, have to deal with osql and isql.

    Best regards.

    Carl

  • Sorry Carl; I assumed it was 2005 because it was under 2005 category. Sorry.

    In OSQL case the only way I was able to get data import to work properly was by making sure import file was unicode. So I openned the file up in Notepad++ and saved it as unicode and then ran it through OSQL and it imported the data correctly for me ...

    Thanks.

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • Thank's a lot Mohit.

    You are right : I should have posted this tread in the SQL Sevrer 2000 Forum instead of the SQL Server 2005 one (it would have been more relevent).

    My colleague also found yesterday afternoon that using notepad++ and executing the script saved in unicode works fine. Maybe it is our only solution.

    But I am still curious to know how osql (or ODBC underneath) know what to do with a script saved in 850 or in 437 (how to differeciate them).

    Best regards.

    Carl

  • Hmmmm

    I think it might be reading the setting for Non-Unicode programs from your computer..

    Regiona Settings

    Advanced

    -> change that setting to proper lanaguage of choice..

    Mind you it might mess up other programs. I have to change that settings when I am messing around with Japanese. As some programs don't let me type in Japanese unless that setting is changed. All my characters go from Japanese characters to "????".

    Mohit.

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • Hello Mohit,

    We finally found. It is the registry value:

    HKLM -> System -> CurrentControlSet -> Control -> NLS -> Codepage -> 850.

    Changing it's value from c_850.nls to c_1252.nls enable us to execute script saved in 1252 code page with osql. 😎

    On the other hand, it's not safe to play with these registry settings.

    Best regards.

    Carl

  • Cool beans :). Thanks for letting me know :).

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • It is with your help that we found.

    So thank's to you also. 🙂

    Carl

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply