Home All Groups Group Topic Archive Search About

SQLCMD: Is it possible to specify result output format?

Author
21 Oct 2006 6:35 AM
Jordan Tan
Any advice greatly appreciated.

Thanks.

jordan.

Author
21 Oct 2006 10:39 AM
Vera Noest
From BOL, sqlcmd commands

Output Options:
[ -o output_file ]
[ -f < codepage > | i: < codepage > [ < , o: < codepage > ] ]
[ -u unicode output ] [ -r [ 0 | 1 ] msgs to stderr ]
[ -R use client regional settings ]

Formatting Options:
[ -h headers ][ -s col_separator ] [ -w column_width ]
[ -W remove trailing spaces ]
[ -k [ 1 | 2 ] remove[replace] control characters ]
[ -y display_width ] [-Y display_width ]

Is this what you are looking for?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
SQL troubleshooting:  http://sql.veranoest.net
___ please respond in newsgroup, NOT by private email ___

"Jordan Tan" <hock-seng.***@au.pwc.com> wrote on 21 okt 2006 in
microsoft.public.sqlserver.tools:

Show quote
> Any advice greatly appreciated.
>
> Thanks.
>
> jordan.
Author
21 Oct 2006 6:17 PM
Jordan Tan
Thanks but I'm not sure whether/how it'd work.

Under SQL 2000 Query Analyzer we are able to specify the output format of a
query result to be tab delimited. We would like to use sqlcmd to call the
same query but the output format of the query output file specified with
the -o parameter is always column aligned.

Show quote
"Vera Noest" <vera.no***@remove-this.hem.utfors.se> wrote in message
news:Xns986380C053AADveranoesthemutforsse@207.46.248.16...
> From BOL, sqlcmd commands
>
> Output Options:
> [ -o output_file ]
> [ -f < codepage > | i: < codepage > [ < , o: < codepage > ] ]
> [ -u unicode output ] [ -r [ 0 | 1 ] msgs to stderr ]
> [ -R use client regional settings ]
>
> Formatting Options:
> [ -h headers ][ -s col_separator ] [ -w column_width ]
> [ -W remove trailing spaces ]
> [ -k [ 1 | 2 ] remove[replace] control characters ]
> [ -y display_width ] [-Y display_width ]
>
> Is this what you are looking for?
> _________________________________________________________
> Vera Noest
> MCSE, CCEA, Microsoft MVP - Terminal Server
> SQL troubleshooting:  http://sql.veranoest.net
> ___ please respond in newsgroup, NOT by private email ___
>
> "Jordan Tan" <hock-seng.***@au.pwc.com> wrote on 21 okt 2006 in
> microsoft.public.sqlserver.tools:
>
>> Any advice greatly appreciated.
>>
>> Thanks.
>>
>> jordan.
Author
22 Oct 2006 11:15 AM
Vera Noest
It should, but I can test only on 2005.
Can you post an example of a query which looses it's output
formatting when executed as a sqlcmd - assuming that you don't use
the -k flag?
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
SQL troubleshooting:  http://sql.veranoest.net
___ please respond in newsgroup, NOT by private email ___

"Jordan Tan" <jordan***@msn.com> wrote on 21 okt 2006 in
microsoft.public.sqlserver.tools:

Show quote
> Thanks but I'm not sure whether/how it'd work.
>
> Under SQL 2000 Query Analyzer we are able to specify the output
> format of a query result to be tab delimited. We would like to
> use sqlcmd to call the same query but the output format of the
> query output file specified with the -o parameter is always
> column aligned.
>
> "Vera Noest" <vera.no***@remove-this.hem.utfors.se> wrote in
> message
> news:Xns986380C053AADveranoesthemutforsse@207.46.248.16...
>> From BOL, sqlcmd commands
>>
>> Output Options:
>> [ -o output_file ]
>> [ -f < codepage > | i: < codepage > [ < , o: < codepage > ] ]
>> [ -u unicode output ] [ -r [ 0 | 1 ] msgs to stderr ]
>> [ -R use client regional settings ]
>>
>> Formatting Options:
>> [ -h headers ][ -s col_separator ] [ -w column_width ]
>> [ -W remove trailing spaces ]
>> [ -k [ 1 | 2 ] remove[replace] control characters ]
>> [ -y display_width ] [-Y display_width ]
>>
>> Is this what you are looking for?
>> _________________________________________________________
>> Vera Noest
>> MCSE, CCEA, Microsoft MVP - Terminal Server
>> SQL troubleshooting:  http://sql.veranoest.net
>> ___ please respond in newsgroup, NOT by private email ___
>>
>> "Jordan Tan" <hock-seng.***@au.pwc.com> wrote on 21 okt 2006 in
>> microsoft.public.sqlserver.tools:
>>
>>> Any advice greatly appreciated.
>>>
>>> Thanks.
>>>
>>> jordan.

AddThis Social Bookmark Button