March 31, 2015 at 10:08 am
I have a report where the users selects the date in the prompt. I need to change the code so the report selects data 14 days before and 14 days after the selected date.
This is why I currently have and it runs:
cast(pymt_dt as date format 'MM/DD/YYYY') = ?
I'm trying to change it to between but it throws an error message when it runs. This is what I changed it to:
cast(pymt_dt as date format 'MM/DD/YYYY') between (? - 14) and (? + 14)
I'm sure the syntax is wrong but not sure how to correct it. The question marks represent the value from the date prompt. The Date Prompt value is date / time.
Thanks for the help....
March 31, 2015 at 2:29 pm
I need to change the code so the report selects data 14 days before and 14 days after the selected date.
WHERE [DateColumn] BETWEEN DATEADD(days,-14,@DateParameter) AND DATEADD(days,14,@DateParameter)
not sure about the sequence of arguments in DATEADD, so you may need to check it... but that's the general idea, I think.
April 9, 2015 at 9:20 am
Thank you for your reply. I ended up using INTERVAL to resolve this issue. Thanks again
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply