var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Using OSQL for Query Output (csv formatted)
I'm running a query with osql, and I'm trying to get some clean output that is comma delimited. So far my line looks like this:
osql -E -n -d mydb -i custom.qry -o "c:\output\results.csv" -h-1 -s ","
This works off a table with only two columns. I'm still left with a lot of extra spaces between the first column output and second column output, and at the bottom the text "(50 rows affected)".
So instead of this:
data1a (lots of spaces here) ,data1b
data2a (lots of spaces here) ,data2b
data3a (lots of spaces here) ,data3b
(50 rows affected)
I want to see this:
Thanks very much for any help.
I can think of two things to remove the rowcount.
1) Add "set nocount on" to your custom.qry.
2) Use BCP. You will have to see if you can make your custom.qry into a view in the database. If it is a single select statement that should not be hard.
Yea, I ended up using SET NOCOUNT ON, and also specificed the width to 500 so the output didn't newline several times. Instead of comma delimited I parsed it as though it was space delimited which works for what I needed it to do.