OSQL output format

  • I want to use OSQL to run a query then create a readable format text file.  I used the -n -h options but still seeing the -- (dash) and the output data are scatted all over the page. Can someone point me to the right direction? Thanks.

  • Something like this maybe:

    osql -Smyserver -dmaster -E -b -h-1 -r1 -Q "sp_who2" -w200 -n

    The -w option sets the page width, which is probably the main cause of data not formatting nicely.

    -h-1 turns the headers OFF, which may not be exactly what you want, but I think it's the only way to eliminate the -- (dash) column heading.

    You could print your own column headers from your query/SP if you need them.

  • Also, when viewing the results online I've found that switching your font to courier 10 will fix quite a bit of your column alignment issues.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

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

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