Global Variable not working in Execute SQL Task
Posted on 2009-05-15
I have a DTS package with an ActiveX Script Task and an Execute SQL Task. My ActiveX script (for testing purposes) reads:
DTSGlobalVariables("POStart").value = 10
Main = DTSTaskExecResult_Success
My Execute SQL Task reads:
INSERT INTO SUMMIT_STAGE_PO (ORDER_NO, LINE_NO, CREATE_DATE, Type)
SELECT * FROM VW_SUMMIT_AUDIT_PO
WHERE CREATE_DATE > DATEADD([HOUR], -?, GETDATE())
I have placed the question mark in as this value should be taken from global variable POStart. However, when I click on the parameters button to assign the parameter I get the following error:
Error Source: Microsoft OLE DB Provider for SQL Server
Error Description: Deferred prepare could not be completed.
Statement(s) could not be prepared.
Invalid operator for data type. Operator equals minus, type equals datetime.
Any ideas guys???