question

Murali Mohan avatar image
Murali Mohan asked

Crystal Report - SQL Query

SELECT COUNT(CASE WHEN ([INTERACTIONREF] IS NULL OR [INTERACTIONREF] ="") AND LEFT([ASSOCIATED INCIDENTREF],2)='IM' THEN 1 ELSE 0 END) AS [MONITORING EVENTS] FROM [Sheet1_] WHERE [CALL LOGGED] BETWEEN {?FromDate} AND {?ToDate} I have written the above query in Add Command of Database Expert, when I am executing the query it is throughing error as "Syntax Error - Missing Operator". Any help Please.
crystal-report
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
This web site runs based on your votes. Please indicate all the helpful answers below by clicking on the thumbs up next to them. If any one answer lead to a solution, please indicate this by clicking on the check mark next to that answer.
0 Likes 0 ·
Grant Fritchey avatar image
Grant Fritchey answered
Try changing this: [INTERACTIONREF] = "" to this: [INTERACTIONREF] = '' See what that does. I think the double quotes are messing things up.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Murali Mohan avatar image Murali Mohan commented ·
getting the same error.,Getting the same error.
0 Likes 0 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Not sure then. It must be something within Crystal Reports and not the query itself.
0 Likes 0 ·
Pavel Pawlowski avatar image
Pavel Pawlowski answered
As @Grant mentioned, first correct the the double quotes. Further depending what provider the cysterl reports are using, you will need to update the paramters in the where condition. In case OLEDB provider is used, you have to remove the paramter names and keep only the question marsk there. All Connection Mangers except ADO.NET uses single question mark for parameter WHERE [CALL LOGGED] BETWEEN ? AND ? ADO.NET is using @paramName WHERE [CALL LOGGED] BETWEEN @FromDate AND @ToDate Of course Crystal Reports can have it internal logic for parameters subsctitution in the queries. But the the above is standard for passing SQL Server parameters.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.