overwrite output file in scheduled task

  • hi experts

    i've created a bat file and scheduled it to run daily at midnight, i used windows scheduled task to trigger it since i'm using sql express, here's the command i've written

    OSQL -U"sa" -P"Pragma1(" -S"PRAGMA\PRAGMA" -d"UDM_AFS_Values" -m6 -e -i"C:\Myfolder\astDepreciationTransactions_Trigger.sql" -o"C:\Myfolder\MyOutput.txt"

    i've tested it and it runs fine, what i want to know is that, is there a way to get the MyOutput.txt file to get overwritten each time?

    the reason i want to go this is that the file will get to big cause the storedprocedure will runs about 3000 records daily.

    thanks

  • Why don't you just delete the file first ?

    xp_cmdshell 'del c:\filelocation'

    "Who then will explain the explanation? Who then will explain the explanation?" Lord Byron

  • thanks for the response.

    do i put the command before -o"C:\Myfolder\MyOutput.txt"? and if the command you gave me delete the file how's gonna get output file.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply