SSIS Loop Container, Dynamic Loop Numbers

Hello, experts.
This is what I'm trying to do.
(1) Get company IDs from Table A and stored that into Table B with identity value, and company name (seq_num)

(2) Table B will look like this:

Seq_Num   |     Company
       1          |       ABCD
       2          |       EFGH
       3          |       IJKL
       4          |       MNOF

(3) The loop starts from value 1 and the ending value is total number of rows (on this example 4)

(4) As the package loops through it matches current cycle # and seq_num and gets the company ID

(5) The transformation task will get the company ID ans use it to pull the data for transformation.

(6) The package is going to stop once it loops through all #s of rows.....
kmc10314Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
Please provide some schema information and if possible some sample source data.
0
kmc10314Author Commented:
Do you need schema information for the table that I pulled the data from?
0
Brian CroweDatabase AdministratorCommented:
Yes, I am trying to better understand your source(s) specifically "Table A" and "Table B".  At first glance you appear to be attempting to apply a procedural solution to a set-based problem.  SQL performs poorly at the former and excels at the latter so I want to make sure I understand what you're starting with.
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

ValentinoVBI ConsultantCommented:
I agree with BriCrowe.  From the looks of it what you need is a Data Flow Transformation with the following components:

o pull in the data from Table A using a source component
o hook that up to a Lookup Transformation to fetch values from some other table (you haven't really mentioned a name here) using your matching criteria
o finalize the flow with a destination component to write data to Table B

Ref Lookup Transformation [MSDN]

If you need to generate an increasing counter, one method is to handle this in the source query.  This is assuming you've got a SQL Server source.  Here's a simple example that demonstrates a method to generate an increasing counter:

with SomeData as (
	select distinct Color
	from DimProduct
)
select Color, ROW_NUMBER() over (order by (select null)) RN
from SomeData

Open in new window

0
kmc10314Author Commented:
Table A -- Load the data into temp table and assign identity as seq. number

SELECT IDENTITY(INT, 1, 1) AS Seq_Num, CH.CompID
INTO dbo.Scheduled_Load
FROM Level2WorkArea.dbo.CorpLoadCo CH
INNER JOIN Level2WorkArea.dbo.CorpLoadSchedule CS ON CH.CompID= CS.CompID
WHERE CS.ScheduleDate = CONVERT(DATE, GETDATE()) 

Open in new window


As a result the table will look like this

Seq_Num   |     Company
       1          |       ABCD
       2          |       EFGH
       3          |       IJKL
       4          |       MNOF

What I'm trying to do is that create a loopand match the loop number with the seq number.
The loop stops as it reach the max of the seq num.
0
ValentinoVBI ConsultantCommented:
What is the point of that loop?

"match the loop number with the seq number"  << okay, but why?  That can't be all, right?

Please explain using an example so that we get a full understanding of what you're trying to do, and thus can give you decent advise.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.