How to pass in clause values via SSIS paramter

KlearnSSIS 1 Reputation point
2021-04-09T06:32:19.5+00:00

Hi,
I have created SSIS package based on the query( big query),In query in clause is there.
I have created parameter in ssis level and trying to pass multiple values(a,b) to in clause ,It is not working how i can achieve.

Can you please suggest how i can do (Without assigning entire query to variable)

WHERE column not in(?)

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

2 answers

Sort by: Most helpful
  1. Monalv-MSFT 5,891 Reputation points
    2021-04-09T07:39:36.673+00:00

    Hi @KlearnSSIS ,

    1.Could you please share the example data and sql query?
    May I know where do you execute the sql query? In Execute SQL Task or Data Flow Task?

    2.Depending on the connection type that the Execute SQL task uses, the syntax of the SQL command uses different parameter markers. For example, the ADO.NET connection manager type requires that the SQL command uses a parameter marker in the format @varParameter, whereas OLE DB connection type requires the question mark (?) parameter marker.
    SELECT FirstName, LastName, Title FROM Person.Contact WHERE ContactID = ?

    Please refer to Parameters in the Execute SQL Task.

    3.The following SQL statement selects rows from the Product table in the AdventureWorks2012 database. The first parameter in the Mappings list maps to the first parameter to the Color column, the second parameter to the Size column.
    SELECT Color, Size FROM Production.Product WHERE Color = ? AND Size = ?

    Please refer to Using Parameterized SQL Statements.

    Best regards,
    Mona


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Olaf Helper 40,736 Reputation points
    2021-04-09T08:58:41.57+00:00

    WHERE column not in(?)

    IN clause with Parameter don't work.
    Use a table, fill in with the parameters in mind and use it to filter, like

    WHERE NOT column IN (SELECT FilterColumn FROM FilterTable)
    
    0 comments No comments