简体   繁体   中英

Query works in Query Designer but not in MS SQL Server Report Builder

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.

我将从where子句中删除to_date函数,例如

where DB_timestamp > :StartDate and ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM