June 22, 2016 at 3:31 pm
Hi Guys,
I need help.
Here is my sample data
ID,FNAME,STATE,AGE
1,JIM,CA,12
2,CARLOS,NY,14
3,JENA,CA,15
4,TIM,GA,12
What I want, I want to create an SSIS Package, where I can create a .csv file from the above data. A number of files created it depends on how many states
of data I have in the table. In above example, it should create 3 files. (1 File of all CA DATA,2 FILE FOR NY DATA,3 FILE FOR GA DATA)
Please advise how I can accomplish this in SSIS.
Thanks in advance
June 22, 2016 at 6:07 pm
rocky_498 (6/22/2016)
Hi Guys,I need help.
Here is my sample data
ID,FNAME,STATE,AGE
1,JIM,CA,12
2,CARLOS,NY,14
3,JENA,CA,15
4,TIM,GA,12
What I want, I want to create an SSIS Package, where I can create a .csv file from the above data. A number of files created it depends on how many states
of data I have in the table. In above example, it should create 3 files. (1 File of all CA DATA,2 FILE FOR NY DATA,3 FILE FOR GA DATA)
Please advise how I can accomplish this in SSIS.
Thanks in advance
Here it is, in outline.
1) Create a string object variable: States.
2) Create an execute SQL task which populates States with the results of
select distinct state
from SourceTable
3) Create a Foreach loop which iterates round the results in 'States'.
4) Add a data flow task to the Foreach loop, with an OLEDB source and flat file destination.
i) The query for the source needs to be dynamic, using the 'current' value of 'States'.
ii) The output file name also needs to be dynamic, using the 'current' value of 'States'.
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
June 23, 2016 at 8:13 am
Awesome Phil, It WORKS!
Thank You.
June 23, 2016 at 8:33 am
rocky_498 (6/23/2016)
Awesome Phil, It WORKS!Thank You.
Great, well done!
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
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply