Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How To Write Query Results to .CSV

Author  Topic 

JackOfAllTrades
Starting Member

12 Posts

Posted - 2008-02-04 : 15:02:26
select 'activity_accumulator', count(*) from activity_accumulator;

A simple query. But when I use a job to dump this to text file/csv, I get:


Job 'GetRowCount' : Step 1, 'QueryRowCount' : Began Executing 2008-02-04 11:47:49

-------------------- -----------
activity_accumulator 1032156

(1 rows(s) affected)


All I want is the actual value, appended to the contents of the file. Not the job name, step name, expanded date/time. It would be nice to have the date in a different collumn of the .csv

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-02-04 : 22:52:39
Run the query in sqlcmd as cmdexec type, specify output file with -o option. You can find detailed syntax in books online.
Go to Top of Page
   

- Advertisement -