Jump to content
We've recently updated our Privacy Statement, available here ×

SQL query is fine but Jasper returns an error


joaoflima.6

Recommended Posts

Hi there,

I'm just started with Jaspersoft Studio and I'm facing a really annoying issue.

I want to create a report with a line chart to show the number of the tickets created per hour, for the last 7 hours. 

I wrote the SQL query, it's running well and returning the expected results when executed on SQL Server Management Studio.

When I create the report using the query as the dataset, it works fine in Preview mode but when it comes to the web browser it returns this error:

  • An error has occurred. Please contact your system administrator. (6632)

Here is the SQL query:

WITH all_hours AS (
    SELECT DISTINCT number, 0 tickets 
    FROM master..spt_values
    WHERE number BETWEEN DATEPART(HOUR, dateadd(S, DATEDIFF(SECOND, '19700101', SYSDATETIME()), '1970-01-01')) - 7 AND DATEPART(HOUR, dateadd(S, DATEDIFF(SECOND, '19700101', SYSDATETIME()), '1970-01-01'))
)
SELECT
    CONCAT(CAST(ah.number AS VARCHAR), 'h') AS hora,
    SUM(CASE WHEN cr.open_date > DATEDIFF(SECOND, '19700101', SYSDATETIME()) - (3600*7) THEN 1 ELSE 0 END) AS tickets
FROM all_hours ah
LEFT JOIN call_req cr ON ah.number = DATEPART(HOUR, dateadd(S, cr.open_date, '1970-01-01'))
GROUP BY ah.number;

 

I read that this error message can be related to the SQL query, but it's running fine on SQL Server Management Studio, I think it should run fine as well on Jasper. 

Can anyone help me with this problem? 

Thanks in advance.

Greetings, 
João

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...