Feeds:
Posts
Comments

Posts Tagged ‘ssis dynamic file name’

Recently i was supposed to generate a text file dynamically in run time with date and time appended to file name!

To accomplish this click on flat file connection ,in right hand side properties window will appear.
Look for expressions there and once you click on that another window will pop up asking for what you want to set expressions!

Choose connection string in drop down and then copy/paste below by modifying your directory.

I have choosen # to seprate date and time, you can choose your own!

Alternatively, you can use two variables say @FilePath and @Filename and compute like below if you are getiing this variable in runtime.

“\\”+”\\”+”HostName/computer
name”+”\\”+”FolderName”+”\\”+”SubFolderName”+”\\”+”FileNameTobeAppendedw ithdatetimeInEnd”+(DT_STR,4,1252) YEAR(GETDATE())+”-“+(DT_STR,2,1252) MONTH(GETDATE()) +”-“+(DT_STR,2,1252) DAY(GETDATE())+”#”+
(DT_STR,2,1252)DATEPART(“hh”,GETDATE())+”-“+(DT_STR,2,1252)DATEPART(“mi” ,GETDATE())+”-“+(DT_STR,2,1252)DATEPART(“ss”,GETDATE())+”.txt”

Advertisements

Read Full Post »

%d bloggers like this: