unable to successful run pkg that passes parameters to query

  • Very much needing urgent help. Could someone pls walk me through this problem?

    I am getting this SSIS error:

    Error: Cannot evaluate expression "@[User::FromDate] = (DT_DATE)DATEADD( "d", DATEDIFF( "d", (DT_DATE) 0, getdate())-2, (DT_DATE) 0)" because the variable "User::FromDate" does not exist or cannot be accessed for writing. The expression result cannot be assigned to the variable because the variable was not found, or could not be locked for write access.

    I don't understand what is meant that the variable doesn't exist or is locked. I have created it...attached snapshot

    --Quote me

  • I have discovered that I used name of variable as part of Variable expression. I have removed that and am now getting error about parameter binding.
    [Execute SQL Task] Error: Executing the query "DECLARE
    @FromDate AS DATETIME,
    @ToDate AS DATETIM..." failed with the following error: "Unsupported data type on parameter binding 0.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.  attached snapshot of Parameter configuration.

    --Quote me

  • i have changed datatype of parameters from DATE to VARCHAR and now the package runs but sql task inserting NULL for all values dependent on the value of passed parameters. 

    So, I am having issue with
    A. writing an expression that returns this format: '2017-06-01 00:00:00.000'
    B. passing it to sql query (in execute sql task) which in SQL Server runs successfull with following declarations/parameter settings:
    DECLARE
    @FromDate AS DATETIME,
    @ToDate AS DATETIME

    SET @FromDate = '2017-05-01 00:00:00.000'
    SET @ToDate = '2017-06-01 00:00:00.000'

    would someone be willing to take a look at this problem with me?  I am first in need of A, getting the right expression.

    My expressions are:
    (DT_DATE)DATEADD( "d", DATEDIFF( "d", (DT_DATE) 0, getdate())-19, (DT_DATE) 0)  ---> 6/2/2017 12:00:00 AM

    (DT_DATE)DATEADD( "d", DATEDIFF( "d", (DT_DATE) 0, getdate())-1, (DT_DATE) 0) --> 6/20/2017 12:00:00 AM

    --Quote me

Viewing 3 posts - 1 through 2 (of 2 total)

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