Reputation: 46222
I need to do the following:
Select ProID from Pros ps where ps.ProId = '102-C01-1299'
and ConfirmDate > DATEADD(DAY, (select tt.DaysDue from tblTaskTimeline tt where Task = 'TaskInfo') as days,ps.ProgStartDate)
Note how for the DATEADD function, I need to dynamically get the 2nd parameter. Note that tt.DaysDue returns an integer value.
I get a message saying that DATEADD requires 3 parameters.
Upvotes: 1
Views: 1679
Reputation: 247650
Why not just create a parameter first?
declare @days int
set @days = (select tt.DaysDue from tblTaskTimeline tt where Task = 'TaskInfo')
Select ProID
from Pros ps
where ps.ProId = '102-C01-1299'
and ConfirmDate > DATEADD(DAY, @days, ps.ProgStartDate)
If you cannot use a parameter then the following should work:
Select ProID
from Pros ps
where ps.ProId = '102-C01-1299'
and ConfirmDate > DATEADD(DAY, (select tt.DaysDue from tblTaskTimeline tt where Task = 'TaskInfo'), ps.ProgStartDate)
Upvotes: 1