|
|
Question : Dynamic source location in SSIS
|
|
I am creating an SSIS program to load 3 flat files into SQL every month from a specific location. However, the file names will change every month. I would like to get a directory of files at a specific location and load any that have not been already loaded. I expect to log which files have been loaded in a SQL table.
How do I write a script in SSIS that can access the operating system? How do I write one that accesses the sourceconnectionflatfile properties? In DTS, I would rename the source file dynamically using ActiveX. It looks like I could go back to ActiveX, but I am hoping there is a place or task type that will provide the ability to do this in an intellisense environment. Or a better way to do it entirely.
Or am I dreaming that SSIS is an improvement over DTS?
Thanks!
I used to be an expert in dts (tho that was 3 years back). Now I am learning SSIS. I know c# and have written a few VB.NET programs. I am a SQL guru, so I do not need any help on the SQL side of things.
|
Answer : Dynamic source location in SSIS
|
|
Q: How do I write a script in SSIS that can access the operating system? A: Using Script Task or Script Transformation and designing script to use System.IO namespace and its classes. But always think twice before you use scripting. Some operations can be performed with out-of-the-box package elements.
Q: How do I write one that accesses the sourceconnectionflatfile properties? A: Create a package level string variable (let's name it FileName). In flat file connection manager properties look for Expressions and set ConnectionString to the FileName variable value. Then in your scripts the ConnectionString will be enabled for dynamic changes through the FileName variable (remember to add FileName variable to the list in ReadWriteVariables property of Script Task or Script Transformation).
Q: Or am I dreaming that SSIS is an improvement over DTS? A: This is the reality, my friend :-) It really is an improvement.
|
|
|
|
|