Formatting SQL output in a text file.

  • Hi

    I'm running an SQL query and outputting the results to a text file. But the columns appear a little skewed.

    Is there anyway to control the format of the output text document.

    By the way I'm outputting to text file using the OSQL utility.

    Thanks

  • By default the columns should line up ok. Are there any characters in your output (tabs, crlfs, etc) that could be throwing things out?

    You might to need to employ a combination of REPLACE, LEFT, SUBSTRING (and other functions) together with column aliases.

    If the columns headers are wrapping on output line you may need something like -w500 to increase the output width.

    Cheers,

    - Mark


    Cheers,
    - Mark

  • Using proportional of fixed spaced fonts when displaying the text files

    Maybe try Courier, even in Notepad.exe

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

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