Hello,
I am currently just starting to learn SSIS and I have a question on creating a directory using the File System Task.
Would I be able to create a directory where the directory name is generated and stored in a SSIS variable?
Any help is appreciated and thank you in advance for the assistance.
Eric
In tinkering around with SSIS Designer I found a way to create the directory in question.
|||For info and anyone else wondering, open the task and follow steps below
1 Change Operation to Create directory.
2 Change IsSourcePathVariable to True.
3 Change SourceVariable to the variable you wish to use, or select <New variable> to create one now.
To generate the folder name you can use an expression on the variable. Close the File System Task editor, and setup the expression.
1 Open the SSIS Variables window.
2 Select the variable you wish to work with.
3 Select or Open the Visual Studio Properties window
4 In the Properties window, change the EvaluateAsExpression property of the variable to True.
5 Set the Expression property. This is generates the directory name for you. (SP1 and above will show an ellipsis button against this property which will invoke the expression editor dialog.) For example a folder name of C:\MyFolderyyyymmdd would use the following expression-
"C:\\MyFolder" + (DT_WSTR,4)YEAR(GETDATE())
+ RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2)
+ RIGHT("0" + (DT_WSTR,2)DAY( GETDATE()), 2)
6 Check the Value property of the variable to see the evaluated expression result which will be used by the task.
No comments:
Post a Comment