006_SSIS execute sql task 调用存储过程

时间:2022-04-14 05:34:00

1.首先在SqlServer中创建存储过程:

if OBJECT_ID(‘usp_t013_inset_process_log‘) is not null
drop procedure usp_t013_inset_process_log
go
	create procedure usp_t013_inset_process_log
	@execution_id varchar(50),
	@package_name varchar(50),
	@machine_name varchar(50),
	@id int output
	as
	begin
		insert into T013_PROCESS_LOG values(@execution_id,@package_name,@machine_name,GETDATE(),null,1);
		select @id = @@IDENTITY;
	end
	return 1;
go

2.在sql task 中输以下语句用于sql调用

declare @id_ int
declare @return_value int 
execute ? = usp_t013_inset_process_log
@execution_id = ?,
@package_name = ?,
@machine_name = ?,
@id = ? output

3.创建两个参数用于获得返回值与输出值,在参数映射部分配置好对应的映射,注意参数名称的值大小与sql语句中的?依次对应

006_SSIS execute sql task 调用存储过程