Quantcast
Viewing all articles
Browse latest Browse all 24688

SQL Task with input and output parameters (filter the result and return the filtered single value result to an SSIS variable)

I have an SSIS Execute SQL Task set up with the following configuration which works when I just try to return the results of a simple query, a simple sum of a column. When I try to parameterize it so it will only return rows for the correct ExtractType and DayKey, I get many different errors depending on how I set it up, either syntax or something like these:

no result rowset is associated with the execution of this query

Multiple-step OLE DB operation generated errors. Check each OLE DB status value

  THIS IS WORKING:
  SSIS Variable:
    Variable Name: User::strSumIntrOrigFace
    Scope: Package
    Data Type: String
    Value: NULL
    Note: This is a number converted to string. I would like to keep it a number, but I seem to be getting even more errors this way.

  Execute SQL Task Editor:
    General Tab:
      ResultSet: Single row
      ConnectionType: OLE DB
      SQL Source Type: Direct input
      SQL Statement:
        SELECT CAST(SUM(INTR_ORIG_FACE) AS VARCHAR(20)) AS SUM_INTR_ORIG_FACE
        FROM vwEXTRACT_TBSM
    Parameter Mapping tab:
      Variable Name: User::strSumIntrOrigFace, Input, VARCHAR, Parameter Name=0, Parameter size=20
    Result Set Tab: 
      Result Name:SUM_INTR_ORIG_FACE, 
      VariableName: User::strSumIntrOrigFace
    Expressions Tab: None

  WHEN I TRY TO ADD a WHERE clause to the SQL statement, it doesn't work and I get the aforementioned errors.
  WHERE ExtractType = ? AND DayKey = ?

  SSIS Variables available to use:

    Variable Name: User::strExtractType
    Scope: Package
    Data Type: String
    Value: DA 
    Note: (this for daily)

    Variable Name: User::strDayKey
    Scope: Package
    Data Type: String
    Value: 19000101
    Note: This is an integer converted to string

If someone can help me "hook" up these variables, parameters, question marks, etc. I would appreciate it. All I want to do is add the filter to the query (By ExtractType and DayKey.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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