|
I created a job on SQL that executes every day at 4 am , the option OUTPUT FILE under the ADVANCED TAB in creating a new job process enables me to save the job to a required text file , i have two options , 1 is to append on the same file , 2 is to overwrite the same file , the problem is that both dont work for me , the problem is a need each days execution to be on a seprated text file for example when executing it on first of december the file name prodoced will be myfile0112 , and on secound december the file name will be myfile0212 and so on every day the job executes it creates a new text file on c with name of the file + date , i need it automized just as the job is , and please i need it as simple is it could , am using SQL2008 By the way Thanks
(comments are locked)
|
|
I have a SQL job one every server which runs at midnight every day. It loops through each sql job in msdb.dbo.sysjobs and executes the following to change the output file name.
You will just need to write some code to come up with what you want @NewOutputFileName to be. This is pretty much what I use to build the new filename each day
(It helps when you don't have spaces in your job name. Otherwise you may need a little additional code to remove spaces.) Brannon
(comments are locked)
|
|
Dear madhivanan, Thank you for caring to answer me , but am not able to understand your answer , for example where will this file be located , where to but the file name path? can u please provide one small script that includes writing thr result on a text file with anyname unders the c:\ directory for example , please give me more details . Thank you Ahmed
(comments are locked)
|
|
Try this
(comments are locked)
|
|
An alternative answer would be to have some external process rename the file (including the date/time in the name) after it is created.
(comments are locked)
|
|
I used the answer from bweigel to build up a solution to this problem. I have blogged it here SQL Server job step output file using job names and tokens
(comments are locked)
|
1 2 next page »

