Feedback
Did this article resolve your question/issue?

   

Article

Extra brackets around COALESCE statement causes a parsing error with the SQL Server ODBC driver

Information

 
TitleExtra brackets around COALESCE statement causes a parsing error with the SQL Server ODBC driver
URL NameExtra-brackets-around-COALESCE-statement-causes-a-parsing-error-with-the-SQL-Server-ODBC-driver
Article Number000180286
EnvironmentProduct: Connect for ODBC SQL Server driver
Version: 07.16.0284
OS: all supported platforms
Database: SQL Server
Application: all supported applications
Question/Problem Description
Extra brackets around a COALESCE statement causes the below parsing error. The error is only seen when there is also a where clause specified with a parameter.
Steps to Reproduce
Clarifying Information
Run for example the following statement:

SELECT (COALESCE(LI.col1,0.0) + COALESCE(LI.col2,0.0) + COALESCE(LI.col3, 0.0) - COALESCE(LI.col3, 0.0)) monthlyPayment FROM cotest AS LI WHERE LI.col1 = ?
Error Message[DataDirect][ODBC SQL Server Wire Protocol driver]Error encountered during the SQL Parsing.
Defect NumberDefect 48694
Enhancement Number
Cause
Resolution
Fixed in hot fix 07.16.0303. 
Refer to "Connect and Connect64 for ODBC hot fix download and install instructions" for instructions on how to download and install the hot fix.
Workaround
Remove the extra brackets:

SELECT COALESCE(LI.col1,0.0) + COALESCE(LI.col2,0.0) + COALESCE(LI.col3, 0.0) - COALESCE(LI.col3, 0.0) monthlyPayment FROM cotest AS LI WHERE LI.col1 = ?
Notes
Last Modified Date10/19/2016 9:24 AM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.