Exporting SQL Data - Naming CSV Export File

Hello Exports,

I have a SSIS package created to export SQL Server 2012 data to a flat CSV file. I'm running the package using SQL Server Agent job. Everything works as anticipated and the data is exported. However, the file is stored as test.CSV and when the job runs the second time, the package overwrites the existing file.

Another application is picking up this CSV file and if it did not pick up this file before the SQL job runs the next time - the data will be lost. Is there a way I can specify file name, like current datetime (so it creates unique file names) when stored the CSV file on the screen attache below (see image)?

Please let me know how I can avoid this.

Thanks.SQLExport.jpg
Evan FiddlerAsked:
Who is Participating?
 
SimonConnect With a Mentor Commented:
I suggest you look at this previous thread which explains it clearly:
Create dynamic file name for flat file destination
Basically, using an expression instead of a hard-coded connection string for your flat file destination.
0
 
Evan FiddlerAuthor Commented:
Idk how I missed it. Thanks for pointing it out. I will test it and will let you know if needed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.