Problem with numeric parameter in DATEADD with DTS -
05-29-2006
, 12:29 PM
I am trying to construct a DTS task which will purge data that is more
than X months old.
So, I have a line in my query that looks like this:
DELETE...
WHERE [dateObj] < DATEADD (month,?,getDate())
I am trying to use a parameter so I can simply set a Global variable to
determine the number of months back I want to purge. I triedsetting the
global variable to an Int, to an Integer, I keep getting this error:
Error Description: Deferred prepare could not be completed.
Statement(s) could not be prepared.
Argument data type datetime is invalid for argument 2 of dateadd
function.
What gives? I'm not trying to use a datetime, I'm trying to use a
number. I have -6 programmed in as the value of the variable
monthsBack.
Any clue what I'm doing wrong? |