Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Exporting to excel from SQL Server

Author  Topic 

huffdawg
Starting Member

2 Posts

Posted - 2008-10-08 : 12:48:49
I have a SSIS package that will run every night. It will import several files and run some SQL code which puts the results into a "results" table. What I need to do is export that file using a data flow task. I can do that, but what I need to do is create a file each night with todays date. for Example:

todays date is 10/01/2008. I want the file to export to be:

results_10012008.xls

and on 10/02/2008 I want it to be:

results_10022008.xls

and so on.

I can create a date variable, but how do I update that variable (i.e. which task do I use to put the script), what is the script, and how do I get the variable in the excel export file name data flow task?

Please help.

HuffDawg

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-08 : 13:53:46
you dont need to use any task. just go to excel destination task and use expression builder and map the filename property to expression

'results_' + [@user::Datevariable] + '.xls'

steps for accesing expression builder is given in link below

http://msdn.microsoft.com/en-us/library/ms141698.aspx


and example can be found here

http://www.mssqltips.com/tip.asp?tip=1084
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 14:46:27
Here is my favorite:
http://www.sqlnerd.com/ssis_dynamic_dates.htm
Go to Top of Page
   

- Advertisement -