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


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


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

  • Ecomator

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

  • Kasper de Jonge

    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?