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 2008 Forums
 SSIS and Import/Export (2008)
 Export files with naming conventions

Author  Topic 

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2012-01-10 : 08:57:14
Hello All,

My SSIS package exports some files in CSV format and currently they save on C drive under TEST folder.

The folder and export files need to have centain naming conventions.

All the files should be dumped in a folder named:
MCP_<Name of Server>_YYYYMMDDHHMMSS

The multiple CSV files under this folder should be named as:
MCP_ExpOrders_YYYYMMDDHHMMSS.CSV
MCP_PendingOrders_YYYYMMDDHHMMSS.CSV
etc..

Can someone help me on how to do it in SSIS package?

Thanks,

mandm
Posting Yak Master

120 Posts

Posted - 2012-01-13 : 13:14:22
We usually handle those kinds of tasks in VB script or Batch files. We will dump the files out to a standard name then as a last step rename them and move them to the appropriate folder.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-14 : 00:59:05
you can use an expression for that. Add a variable in SSIS with evaluateasexpression property as true and then set corresponding expression like

"MCP_" + @[User::ServerName] + "_" + REPLACE(REPLACE(REPLACE( (DT_WSTR, 30) (DT_DBTIMESTAMP) @[System::StartTime],":",""),"-","")," ","") + ".CSV"


You should have declared variable ServerName before and stored the servername before you do the above things

and once the above filename variable is set, map it to connectionstring property of your file connection manager in its properties tab.

[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -