Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Perform while loop task in SSIS

$
0
0

Hi,

I am using SSIS to perform the following:

DECLARE @FirstID bigint,
		@LastID bigint
		
WHILE @FirstID<=@LastID
 BEGIN
	DECLARE @TempID bigint
	set @TempID=@FirstID+10000
	if @TempID>@LastID
	set @TempID=@LastID
  Insert vru.call_function_log_tmp_fc01 (nid,call_id,dept_id,function_id,log_datetime)
  select nid,call_id,dept_id,function_id,log_datetime from dbo.call_function_log
  where nid between @FirstID and @TempID
  
  set @FirstID=@TempID+1
 END

I am using For loop container and data flow task to achieve this.

For loop has been configured as

Eval expression: @FirstID<=@LastID

Assign expression:  @FirstID=@TempID+1

The variable @tempid is set as expression:

“set  @[User::vTempID]  =  @[User::FirstID] + 10000

if @[User::vTempID] > @[User::LastID]

set @[User::vTempID] = @[User::LastID]”

The data flow in For loop has SQL from varibale configuration. The variable is to set to expression as:

SELECT NID,call_id,dept_id,function_id,log_datetime FROM dbo.call_function_log WHERE nID BETWEEN "+ (DT_STR, 25, 1252)  @[User::FirstID]+"     AND "+(DT_STR, 25, 1252)@[User::LastID]+"

My question is that if that it will work as while loop to load 10000 records at time. Am I missing any thing.


hsbal


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>