need help regarding executing stored proc in Execute SQL task

  • Created s - proc for data insertion with 4 parameters to be passed

    create procedure insterdata

    @firstname varchar(100),

    @middlename varchar(100),

    @lastname varchar(100),

    @contactid int

    as

    insert into dbo.ContactInfo(firstname,middlename,lastname,contactid)

    values(@firstname,@middlename,@lastname,@contactid)

    i want to execute this s proc in Execute SQL Task.

    can any body help me how to execute this insert proc from Execute SQL task.

  • The code inside the Execute SQL Task would be as follows:

    DECLARE @firstname VARCHAR(100), @middlename VARCHAR(100), @lastname VARCHAR(100), @contactid INT;

    SET @firstname= ?; -- 0

    SET @middlename= ?; -- 1

    SET @lastname= ?; -- 2

    SET @contactid= ?; -- 3

    EXEC dbo.insertdata @firstname, @middlename, @lastname, @contactid

    In the parameter mapping, you specify the SSIS variables as input with the appropriate data types. Make sure you give them the correct ordinal position, as they will be mapped agains the question marks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Just curious why you wouldn't simply specify that the call is a stored procedure and then add the input parameters.

    Enter the scheme.name of the procedure and specify Is Stored Procede = true. Then use the input parm names @parm and map to variable in the parameters section.

  • Tom Van Harpen (2/25/2011)


    Just curious why you wouldn't simply specify that the call is a stored procedure and then add the input parameters.

    Enter the scheme.name of the procedure and specify Is Stored Procede = true. Then use the input parm names @parm and map to variable in the parameters section.

    I didn't know that was possible. Until now 😀

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thanks a lot as simple as that. really appreciate

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply