Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in August and this forum will be retired.

Not a real question here, just reporting a bug in version
When upgrading from version 11 to 16 I ran into a problem with a query that crashed the asa 16 engine. I managed to pinpoint the problem to a "having 0 in (field, 1)" construct.

Depending on how complex the query is you will either get an assertion failed error (106104) or it will crash the engine. The following queries will reproduce this behaviour:


select max(count) as max_count, table_type  
  from sys.systable 
 group by table_type  
having 0 in (max_count, 1)


Could not execute statement.
Run time SQL error -- ERROR Assertion failed: 106104
Field unexpected during compilation
SQLCODE=-300, ODBC 3 State="HY000"
Line 1, column 1


select max(c.width) as max_width, t.table_type  
  from sys.systable as t  
       left outer join sys.syscolumn as c  
                    on c.table_id = t.table_id  
 group by t.table_type  
having 0 in (max_width, 1)


dbeng16 has encountered a serious error and needs to close

The workaround for this problem is simpel. Just replace the having clause with "0 = field or 0 = 1".

And in case you're wondering: the actual query we used looked like this "having 0 in (field, :param)" where we use the param value to optionally apply the having clause.

asked 11 Nov '14, 04:39

Christian%20Hamers's gravatar image

Christian Ha...
accept rate: 42%

Thanks for the simple repro Christian. I've opened QTS 774060 to address the issue.

permanent link

answered 11 Nov '14, 09:33

Reg%20Domaratzki's gravatar image

Reg Domaratzki
accept rate: 36%

FWIW, according to the CR note this has been fixed with and

(06 Jan '15, 07:46) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 11 Nov '14, 04:39

question was seen: 2,283 times

last updated: 06 Jan '15, 07:46