0

I'm connecting to ORACLE data for SSRS purposes, using Microsoft Business Intelligence Development Studio.

I need to return data where a date is less than 15 days from today. I've tried the sql that works in ORACLE:

<= to_char(sysdate, ‘yyyymmdd’)-15

but it doesn't work in BIDS - when I move away from the filter field quotes are applied to turn the whole function into a string.

If someone can let me know the correct syntax it would be a real help.

Thanks Neil

Neil Deeley
  • 57
  • 1
  • 9

1 Answers1

0

Try this:

to_char(trunc(sysdate)-15, ‘yyyymmdd’)

Trunc will remove the time part from your system timestamp.

mucio
  • 7,014
  • 1
  • 21
  • 33
  • Hi Mucio, I tried, but ssrs converted it into the following: = TO_CHAR(TRUNC(TO_CHAR(SYSDATE, 'J')) - 15, 'yyyymmdd'), and then returned an ORA-01481 invalid number format model error when run – Neil Deeley Nov 05 '13 at 10:56
  • Thank you - this did work when I entered it directly into the code view of BIDS, rather than the design view, which does not parse oracle SQL correctly. – Neil Deeley Nov 20 '13 at 08:49