Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Studio - DTS package to create new txt file using script

Status
Not open for further replies.

arodri

Technical User
Jul 9, 2010
121
US
Hello,

I have a Visual Studio 2005 dtsx package that I created and then imported to SQL Server Agent as a job that is scheduled to run daily. The package basically executes sveral stored procedures (in SQL server mgmt studio) that populate a CUSTOMER table and a TRANSACTIONS table. Then it selects everything from both tables, and puts the contents into two txt files (Cust.txt , Trans.txt).
Right now, there are only 2 txt files that I listed as Connections and everytime the job runs, it just overwrites everything that is in each txt file.

I've only ever created pretty simple jobs, so I'm stuck on the next step that I need to create:

Instead of having only 2 txt files, I need the package to create a 2 new ones (one for CUSTOMER and one for TRANSACTIONS) each day and name those files with the date that's in the data - it's not the current date though. The data is going 7 days back (DATEADD(day, -7, GetDate())) so the new file name should be: Cust6-16-11.txt

I'm not sure how to create new txt files without having them already out there to establish them as connections in the Connetion Manager...? I'm guessing this might require some sort of scipt?

Thanks in advance for any help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top