Member Avatar for Geek-Master
Geek-Master

Has anyone found any documentation on how to properly pass variables from a SQL Table over to another task within the Foreach Loop container? Basically I want to take two columns from a table and pass them into a stored procedure that will be executed within a SQL Task within the Foreach Loop container. However, I can't seem to pass variables between the tasks.

I have some t-sql code that does the same thing, but I would like to become more familiar with SSIS and create full feature packages that do way more.

example t-sql code

declare @i int
declare @max_index int
declare @keep_id int
declare @merge_id int

set @i = (select min(duplicate_index) from merge_these)
set @max_index = (select max(duplicate_index) from merge_these)

while @i <= @max_index
begin
   set @keep_id = (select keep_id from merge_these where duplicate_index = @i)
   set @merge_id = (select merge_id from merge_these where duplicate_index = @i)

   exec sp_merge_ids @keep_id, @merge_id

   set @i = @i + 1
end
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.