Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

stored procedure results to a txt or csv file using SQL Server agent JOB

$
0
0

hi all,

created a job and with TSQL script

EXEC xp_cmdshell 'bcp "exec sp_who2" queryout "C:\job results\abc.csv" -T -c'

the job execution was successful and am getting the required data but the data was overwritten on the same file.

I required the next execution and output to different file every time for each execution. in simple words, required a new file every time with outputs.

thanks and regards,

SQLLover


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>