Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 How to create in SSIS?

Author  Topic 

JJ297
Aged Yak Warrior

940 Posts

Posted - 2010-04-15 : 10:25:26
I have a text file that's needs to be put into SQL. I added a flat file connection to my Data Flow and configured the text file with the breaks etc...

Next I would like for the data to be split up and go into two different tables.

Here's some data from the text file:


DryCd1 DryDte1 DryFu1 DryCd2 DryDte2 DryFu2 DryCd3 DryDte3 DryFu3
B9 20100104 1 A6 20100414 1
B4 20071220 1
B3 20070321 1 B5 20070501 1
C2 20100603 1
D9 20091022 1
K4 20070625 1 B5 20070901 1


I created a table in SQL to grab this info:

DryCdIn int
Drycde (varchar(2))
Drydat (datetime)
Dryfu varchar(1))

I would like for all of the drycd's info to be listed in this table so that means the two drycd's in row 1 would be listed separate as well as in row 3 and 6.

How would I be able to set this up as I have nulls in some of the other fields.

Here's the other table:

WeeklyID int
DataID int - this is the id from the above table.
recno (varchar(2))
fname (varchar(15))
lname (varchar(23))


Would I use a Multicast to split up what I want to go to two different destinations? How do I take which columns I want for each table?

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2010-04-20 : 04:25:18
In the Dataflow tab there is a task called the conditional split which you can split out the direction of data to different table based on the condition. As you mention one of your condition is drycd's info
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-20 : 05:16:40
What is the other table for?
Maybe you can give us an example for the wanted output of all destination tables?

If conditional split isn't working for you then you should import all data in a fitting staging table first and then split the records into the destination tables.

But at this time it is not clear to me what the result of your package should be.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2010-04-29 : 11:30:37
What I did was use a Multicast which split up all of the Diaries and then I used a Union All to add them next to their destination.
Go to Top of Page
   

- Advertisement -