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
 General SQL Server Forums
 New to SQL Server Programming
 SQL JOB Scheduling

Author  Topic 

satheesh
Posting Yak Master

152 Posts

Posted - 2011-03-01 : 10:38:09
Hi All

For ex:i have this sp EXEC sp_XYZ;(no input parameter).upon execution it returns set of rows as result.

1.I want to run this sp every day (need to schedule this using job) and store the output result in c:\\.

How to do this using SQL server agent?Mainly i want to know how to export the result and store that as .csv file in given location.?Any help would be highly appreciated.Thanks.

Regards,
SG

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-03-01 : 11:09:45
I'll use BCP for this
bcp "EXEC database.schema.sp_XYZ" queryout c:\dba\xyz.csv -c -SserverName -T -t,
Go to Top of Page
   

- Advertisement -