Parameter Order in SSIS SQL Task

RoyB09 306 Reputation points
2023-02-08T21:43:36.7233333+00:00
I’m passing 2 parameters into a SQL Task in SSIS as follows ... 

UPDATE dbo.MyTable 

SET RunDate=GetDate(), 

RunDuration=datediff(second, ?, GetDate()) 

WHERE CourseTitle=? 

  

What I want to do (but can’t find a way to) is pass 3 parameters like this... 

UPDATE dbo.MyTable 

SET RunDate=Param2 

RunDuration=datediff(second, Param1, Param2) 

WHERE CourseTitle =Param3 

 
Is this possible 

Thanks in advance  

Roy 
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Jingyang Li 5,896 Reputation points Volunteer Moderator
    2023-02-08T21:56:54.38+00:00

    In Parameter mapping, you should be able to map these variables with sequence

    From Execute SQL Task Editor:

    For parameter Name: 0, 1, 2, 3 respectively to map your parameters. 0 and 2 are the same to map to Param2.

    UPDATE dbo.MyTable

    SET RunDate=? RunDuration=datediff(second, ?, ?)

    WHERE CourseTitle =?

    Check out this discussion:

    https://stackoverflow.com/questions/7610491/how-to-pass-variable-as-a-parameter-in-execute-sql-task-ssis

    0 comments No comments

  2. ZoeHui-MSFT 41,491 Reputation points
    2023-02-09T01:43:48.4633333+00:00

    Hi @RoyB09

    If you are using OLE DB connection, the Parameter marker should be ? and the Parameter name should be 0, 1, 2, 3, ...

    User's image

    Check it out here: Execute SQL Task

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  3. Olaf Helper 47,436 Reputation points
    2023-02-09T06:25:20.43+00:00

    What I want to do (but can’t find a way to) is pass 3 parameters like this...

    Sure it's possible; you didn't mentioned what exactly the problem is?

    Depending on the data source (which you also didn't mentioned) you have to use the question mark ? as placeholder for a parameter on you can use named parameters like @ parameterName.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.