Home > SQL Server > Schedule SQL Query output to file, the simple way

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.

Categories: SQL Server Tags:
  1. Ecomator
    November 20th, 2009 at 00:44 | #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. Kasper de Jonge
    November 20th, 2009 at 05:53 | #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

  1. No trackbacks yet.