August 27, 2008 at 11:14 am
I have an OLEDB source in a Dataflow and am trying to use parameters with a DataAdd function like this:
SELECT OrderNum
FROM Orders
Where OrderDate >= DATEADD(D,?,GETDATE())
Apparently SSIS thinks the parameter must be a Date type because OrderDate is a Date. In any case, this type of code should work and it doesn't.
Has anyone else experenced this behavior? Are there any general workarounds? I can usually find another way to accomplish what I want when I encounter this issue, such as use a stored procedure or write the query differently, but I think this is a bug. Ideas?
February 6, 2012 at 11:40 am
Hi why don't you try this
DECLARE @iNumber AS int
SET @iNumber = ?
SELECT OrderNum
FROM Orders
Where OrderDate >= DATEADD(D,@iNumber,GETDATE())
with regards Ingvi Jón
February 7, 2012 at 12:39 am
Elmer Miller (8/27/2008)
I have an OLEDB source in a Dataflow and am trying to use parameters with a DataAdd function like this:SELECT OrderNum
FROM Orders
Where OrderDate >= DATEADD(D,?,GETDATE())
Apparently SSIS thinks the parameter must be a Date type because OrderDate is a Date. In any case, this type of code should work and it doesn't.
Has anyone else experenced this behavior? Are there any general workarounds? I can usually find another way to accomplish what I want when I encounter this issue, such as use a stored procedure or write the query differently, but I think this is a bug. Ideas?
The solution from Ingvi should work.
But for future reference, try to include the error messages that you receive. Just saying "it doesn't work" is not enough most of the time.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply