RunTime Creating ExcelFileName
Hi...
I am moving data from OLEDB to ExcelFile
I want to generate runtime excel filename as 2days date how to do can u give correct idea...
Thanks
August 4th, 2012 9:36am
Since the Excel file is the destination, it needs to exist before you run the package.
You can store a template Excel file somewhere and use a File System Task to copy it to the correct destination folder. Use an expression to change the name of the Excel file. An example: http://neonlabs.structum.net/blog/ssis-how-to-add-a-timestamp-to-a-excel-file-output-path/
Don't forget to set DelayValidation to true for the dataflow.MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2012 9:43am
1 - Create 2 variables to store the File Name and File Path and assign them some proper values.
2 - Create the Excel File Connection
2 - Create a Script Task and within it set the file name by appending it with date and add code to assign this path to Excel File connection e.g.
string fileName = (string)Dts.Variables["FileName"].Value;
string filePath = (string)Dts.Variables["FilePath"].Value;
string dateString = string.Format("_{0:yyyyMMdd_HHmmss}", DateTime.Now);
string fullFilePath = string.Format("{0}{1}{2}.csv", (!filePath.EndsWith("\\") ? filePath + "\\" : filePath), fileName, dateString);
Dts.Connections["xsl.fileExport"].ConnectionString = fullFilePath;
Hope this helps-
Please mark the post as answered if it answers your question
August 4th, 2012 9:47am
i am doing same process what u said but i am getting error in expression page down i am adding that image
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2012 10:11am
Fancy T-SQL then try
this. Else follow this
link which explains step-by-step how to create excel files dynamically.http://btsbee.wordpress.com/
August 4th, 2012 11:12am
The code that I shared is supposed to be used in "Script Task" not in the variable expression editor.
Follow my earlier post as shared below to create the Script task based on your requirements:
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/6623c7da-5e6c-4fa9-b73a-713a1830c464Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
August 4th, 2012 11:26am
As I see now you have used the Koen Verbeeck. In that case problem is with your copy paste. You are using wrong qoutation characters. Please change the qoutations from to
" before using the code.Please mark the post as answered if it answers your question
August 4th, 2012 11:32am