none
Argument data type for dateadd parameter

    Question

  •  

    I am using the following code in my SQL stmt in my  OLE BD Source stmt:

     

    WHERE ICINVENTORY.ICINVLastChgAt > ? AND ICINVENTORY.ICINVLastChgAt <= DATEADD(mi,?,?)

     

    My parameters are as follows:

    0 - User:LastSalesLoadDate               DateTime variable

    1 - User:Load Interval                          Int16 (or Int32)

    2 - User:LastSalesLoadDate

     

    When I try to close the program I get the following error:

    "Argument data type datetime is invalid for argument 2 of dateadd function.  If I can't use a datetime data type for the date time part of the dateadd, what can I use?

     

    The exact same code runs without error in an EXECUTE SQL task.

     

    Thanks.

    Monday, March 24, 2008 2:08 PM

Answers

All replies

  • Try it with a string type that contains the date.

     

    Monday, March 24, 2008 2:32 PM
    Moderator
  • Thanks....I already converted my stmt to not use the DateAdd....I just use another package variable and do the DateAdd outside the SQL......

     

    Monday, March 24, 2008 2:50 PM
  • Try with this SQL query :

    WHERE ICINVENTORY.ICINVLastChgAt > ? AND ICINVENTORY.ICINVLastChgAt <= DATEADD(mi, cast(? as int), ?)

    or maybe :
    WHERE ICINVENTORY.ICINVLastChgAt > ? AND ICINVENTORY.ICINVLastChgAt <= DATEADD(mi, cast(? as int), cast (? as datetime))


    Alexis Leroy.

    Tuesday, December 16, 2008 9:24 PM