Schedule SQL Query output to file, the simple way

Today two colleagues wanted to schedule the output of a SQL command to a text file so they could check some values on a daily base. After some clicking in SQL Server i found a very simple solution,

I created a SQL server Job Step which executed the SQL command

crop

Then went to the Advanced tab and selected an output file to where the data can be written (even appended):

step

Very simple way to log query output to a file at a regular interval.

2 Replies to “Schedule SQL Query output to file, the simple way

  1. neat…but you should fix the second screenshot and maybe explain more about where to access the section to create a job step.

  2. Hi @Ecomator
    I fixed the image. You can create a job step, by going to the SQL Server agent, Jobs in the sql server management studio connected to a sql server. Right mouse button new Job.

    I hope this helps you?

    Greetings,
    Kasper

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.