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.

1
  • Thank you @AMtwo On the SQL agent Job i opened step and clicked on Advance then I selected a file path where the output should be saved and that all
    – Debby
    Commented Sep 19, 2022 at 22:34

1 Answer 1

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
1
  • I Appreciate, this worked for me.
    – Debby
    Commented Sep 22, 2022 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.