File Encoding in SQL Server Management Studio Save Results As ...

  • I'm running a T-SQL query in Microsoft SQL Server Management Studio and saving the results to a text file: Right-click in Results tab -> Save Results As ... -> Export files (*.csv). The resulting file is "UCL-2 LE", I'm told. It's no good to me.

    If the number of lines returned is less than 8550 I can use Windows CopyPaste buffer to copy the results into a new text file. Or at a Windows 2003 Command Prompt I can convert the file to "1251" with a simple "type filename > filename2". Or if I run the query against the same SQL Server database but in Oracle's SQL Developer the default File Encoding of "Cp1252" gives me what I want.

    I'd like to avoid this second step.

    Is this a global variable I set in T-SQL to the specific encoding I'd like to get before I run my query? Or some option in Microsoft SQL Server Management Studio I need to set? I'm hoping this isn't something that's set at the database/table level which can't be overridden.

  • In the "Save Grid Results" dialog click on the arrow on the "Save" button, you can set the encoding to ANSI there.

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • Doh!

    That's it! That's what I needed!

    Thanks!

    Right-click anywhere in Results Tab

    Save Results As...

    Enter or select a File name

    Then click on the down arrow on the right-hand side of the Save button

    Save with Encoding ...

    ANSI

    Doh!

Viewing 3 posts - 1 through 2 (of 2 total)

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