Help with using XML data source and flat file destination
Hi,
I need to create a flat file fixed width and row delimiter with 5 types of rows which each row having a different number of columns coming from the XML source. Only one of these 5 types of rows will have multiple records.
Say: Only C record will be one or more rows whereas A,B, D & E will also occur once in the text file.
A
B
C
C
C
D
E
Is it possible to process such a text file by fetching data for each row type & then mergeing by using a combination of script task, transformation in SSIS.
Please let me know if any other information is required.
Thanks,
Smeetha
February 12th, 2011 7:27am
you can use Pivot transformation after xml source and achieve results as you want,
this is a sample of Pivot transformation:
http://www.rad.pasfu.com/index.php?/archives/14-PIVOT-Transformation-SSIS-Complete-Tutorial.htmlhttp://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
February 12th, 2011 3:13pm
thanks for the info Reza. i would like to provide additional details and an example:
With the xml data source having multiple child nodes say
<Data>
<Student>
<GeneralInfo>
<Name/>
<SSN/>...
</GeneralInfo>
<ContactInfo>
<Email/>
<PhoneNo/>....
</ContactInfo>
<Courses>
<Course>
<Subject>Science</Subject>
<Testscore>90</TestScore>
</Course>
<Course>
<Subject>English</Subject>
<Testscore>80</TestScore>
</Course> ...
</Courses>
</Student>
</Data>
as u can notice.. the <Course> child node within <Courses> will be repeating multiple times in the xml whereas the <GeneralInfo> and <ContactInfo> node will occur only once.
now using this xml source, a flat file needs to be generated say:
GeneralInfoCol1Col2Col3...
ContactInfoCol1Col2Col3...
CourseCol1Col2Col3...
CourseCol1Col2Col3...
CourseCol1Col2Col3...
....
where each row will have its own set of columns with fixed width... first 2 rows will occur only once in the flat file
whereas course row will repeat as many times as there are <Course> nodes in the XML.
please let me know if is this possible with pivot transformation or any other approach that can be followed?
Thanks,
Smeetha
February 14th, 2011 11:49pm
Hi All,
Does anyone have any suggestions to go about implementing this scenario.
Thanks,
Smeetha
Free Windows Admin Tool Kit Click here and download it now
February 16th, 2011 1:15pm