While I am running the following query in jasper reports, I got the exception. \"net.sf.jasperreports.engine.JRException: Error executing SQL statement for : Activity_Summary\".
This happens because your input parameters are of the data type date
, and not datetime
. Because the date
data type's precision only runs to day level, not anything smaller.
For example, this will fail in SQL Server:
declare @Start as date = '20130201'
declare @End as date = '20130210'
declare @startdate as datetime;
declare @enddate as datetime;
set @startdate = DATEADD(hh, +0, @Start)
set @enddate = DATEADD(hh, +0, @End)
While this will work:
declare @Start as datetime = '20130201'
declare @End as datetime = '20130210'
declare @startdate as datetime;
declare @enddate as datetime;
set @startdate = DATEADD(hh, +0, @Start)
set @enddate = DATEADD(hh, +0, @End)
If you ensure that the parameters supplied by your application (below) are of type datetime
and not date
, you should get rid of the error.
$P{StartDate}
$P{EndDate}