[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

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
0
appliedimg
Asked:
appliedimg
1 Solution
 
SimonCommented:
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
 
appliedimgAuthor Commented:
Idk how I missed it. Thanks for pointing it out. I will test it and will let you know if needed.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now