문제

While using the Microsoft SQL Server Report Builder, I am able to execute a query in the Query Designer and retreive the result. The query has a where clause on dates.

select * from table where DB_timestamp > to_date(:StartDate, 'mm/dd/yyyy') and DB_timestamp <  to_date(:EndDate, 'mm/dd/yyyy')

On execution, I get a pop up where I enter the two variables (StartDate & EndDate) in the given formats. Now when I try to run the same for generating a report, I have to select the two variables using a calender picker. Altough the dates show up in the desired format, I always get the below error:

An error occured during local report processing.
 Query execution failed for dataset 'XYZ'.
ORA-01843: not a valid month

What can cause the query to run successfully in one place but throw an error when the variables are selected by the calender picker?

도움이 되었습니까?

해결책

There mught be some kind of culture clash going on. If SSRS is sending dd/mm/yyyy and your db is expecting mm/dd/yyyy things will not work as expected or even crash on certain dates.

다른 팁

I would remove the to_date function from the where clause, e.g.

where DB_timestamp > :StartDate and ...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top