May 16, 2011 at 1:56 pm
I have noticed my data flow task bombs out when the input file sometimes lacks 3 columns. Am I missing a basic 101 step or do I really have to create 2 different task flows dependant upon whether I have 35 columns or 38?
Thanks!!
May 16, 2011 at 2:11 pm
SSIS can't easily accommodate this sort of requirement. If it's only ever one of two formats, you'll just need two data sources and some conditional logic to force processing down the right path...
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 17, 2011 at 5:19 am
That's what I thought.
Can I put the 2 datasources and the controlling logic in the data tab of 1 SSIS package or do I need to have 2 seperate SSIS packages?
May 17, 2011 at 5:47 am
You can do it in a single package - but you'll need 2 dataflows and some precedence logic to control which is executed. You may also have to set delayvalidation to true to avoid metadata errors.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 17, 2011 at 9:42 am
This might be a long route but this what I have done and seems to work:
Step 1: Script Task - Read in text file & count the header row if count = 35 put file into folder 35 if count = 38 put file in folder 38.
Step 2: Script Task - Do files exists in folder 35 if so set variable fileExistsResult35 = true, also do files exists in folder 38 if so set variable fileExistsResult38 = true.
Step 3: Created Precedence Constraints based on above variables to execute packages that import 35 columns or 38 columns. If fileExistsResult35 = false doesn't execute pkg 1 but = true exec pkg 1, same for fileExistsResult38 = false doesn't execute pkg 2 but = true exec pkg 2.
May 17, 2011 at 10:02 am
This might be a long route ...
I'm afraid it is a bit 🙂 Nonetheless, glad you got there in the end!
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 20, 2011 at 6:05 am
The solution you have above is not very easy to maintain. If you have a file with another set of input columns, then you have to include another data flow to handle it.
If you can use third-party solutions, check the commercial CozyRoc Data Flow Task Plus. It allows handling of variable number of columns at runtime. The case you have described above can be handled with only one data flow.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply