Need option to enable.csv files with date wise instead it is generating one file

  • I have scheduled a job for sql aduit which can give data for 24 hours in .csv ( only need in csv format ) file but when ever it is running it is giving only one file at the mentioned path like X:\Audit\Audit_LOGS.csv instead it should save like

    X:\Audit\Audit_LOGS_10-08-23.csv

    X:\Audit\Audit_LOGS_08-08-23.csv

    X:\Audit\Audit_LOGS_08-08-23.csv

    we need the output file with date wise is there any way in sqlserver job we can define .csv file generate multiple files with date wise rather than overwriting

     

    attached screen shot for it.

    Attachments:
    You must be logged in to view attached files.

    Thanks
    Naga.Rohitkumar

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • I think this could help:

    You may try the bcp command to generate the CSV files with proper file name format plus the current date/timing string:

    Example:

    bcp DBName.SchemaName.TableName out 'C:\Path1\FileName_' + 'Date format_'  +  ' .' + 'txt' csv -S ServerName -T -c -t;

    run as SQL server agent job or a task scheduler in windows.

     

     

     

    DBASupport

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

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