1

I have a query set up in SQL Server agent to return an output result file. The problem I have is how to set a date and time stamp so that the file name always includes the date and time.

On the SQL Agent Job, I opened step and clicked on the "Advanced" tab, then I selected a file path where the output should be saved and that's all.

AMtwo
  • 16,348
  • 1
  • 33
  • 64
Debby
  • 13
  • 1
  • 4

1 Answers1

4

You can use SQL Agent Macros in step output filenames to include the date and time. The macros that might be useful are:

  • DATE
  • TIME
  • STRTTM
  • STRTDT
HandyD
  • 10,432
  • 1
  • 13
  • 27