Monday, February 20, 2012

removing blank spaces from output file

Is there a way to remove blank space padding from around
my result set sent to a text file using osql. I can only
seem to find a column_width setting. I am using the below
and am after a csv file without blank padding.
osql -S(local) -Uuser -Ppassword -s, -h-1 -w254 -
Q"DMSWEB.dbo.rf_test 200035" -oc:\TestReport3.txt
Thanks in advance.
Amelia
Hi,
Consider BCP with QUERYOUT option to do this.
Sample
bcp "exec DMSWEB.dbo.rf_test 200035" queryout
c:\TestReport3.txt -c -S(local) -Uuser -Ppassword
Thanks
Hari
MCDBA
"Amelai" <anonymous@.discussions.microsoft.com> wrote in message
news:2352201c45e43$427d3c60$a501280a@.phx.gbl...
> Is there a way to remove blank space padding from around
> my result set sent to a text file using osql. I can only
> seem to find a column_width setting. I am using the below
> and am after a csv file without blank padding.
> osql -S(local) -Uuser -Ppassword -s, -h-1 -w254 -
> Q"DMSWEB.dbo.rf_test 200035" -oc:\TestReport3.txt
> Thanks in advance.
> Amelia
|||Thanks heaps for your help Hari. Much appreciated.
:0)
Amelia

>--Original Message--
>Hi,
>Consider BCP with QUERYOUT option to do this.
>Sample
>bcp "exec DMSWEB.dbo.rf_test 200035" queryout
>c:\TestReport3.txt -c -S(local) -Uuser -Ppassword
>--
>Thanks
>Hari
>MCDBA
>"Amelai" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:2352201c45e43$427d3c60$a501280a@.phx.gbl...
below
>
>.
>

No comments:

Post a Comment