question

zadien avatar image
zadien asked

SQL Job Output file - Can I append datetime?

Hello, So I have a simple select statement running at a specified time everyday. I'd like to append the current date and time to the output file. Is it possible to achieve this in the 'JOB STEP' properties under the 'Command Line' tab?
sql-agentjoboutput
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Where are you wanting to append the date time to? In the file name?
0 Likes 0 ·
Yes, the filename.
0 Likes 0 ·

1 Answer

·
Tim avatar image
Tim answered
The way I would handle this would be through SSIS, but in the job step you could execute command line and use DOS or any other scripting language to rename your output file.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.