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

Never seen this one before

Sap.Data.SQLAnywhere.SAException (0x80004005): The pattern is too long
at Sap.Data.SQLAnywhere.SACommand._ExecuteReader(CommandBehavior commandBehavior, Boolean isExecuteScalar, Boolean isBeginExecuteReader)
at Sap.Data.SQLAnywhere.SACommand.ExecuteReader()
at Sap.Data.SQLAnywhere.SADataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)

What does 'pattern too long' mean? Can't get find anything for that in Google

asked 14 Sep '17, 17:42

gchq's gravatar image

accept rate: 36%

SQL Anywhere errors are documented in the "SQL Anywhere - Error Messages document". There are several ways to find an error including by message text. If you encounter an SQL Anywhere based error, I would check this document first.

The error is documented here (using SA17 documentation):

The documentation states: The pattern for the LIKE operator is too long. All patterns of 126 characters or less are supported. Some patterns as long as 254 characters are supported, depending on their contents. Patterns longer than 254 characters are not supported.

(15 Sep '17, 10:03) Chris Keating

Think I have figured it out. The SQL was

SELECT Invoice_No as Document, Type, Invoice_Date as 'Date', Customer_Name as 'Name', Details, Amount_Gross as 'Amount', Printed, Posted FROM A_Invoices WHERE (Customer_Name LIKE '%                                                                                                                                                                                                              %' OR Details LIKE '%                                                                                                                                                                                                              %') AND Invoice_Date BETWEEN '2016-08-30' AND '2017-08-30' ORDER BY Invoice_No

The user was searching for a name that matched 206 blank spaces. I'm guessing she rested her plate, with an afternoon snack, on the spacebar :-)

permanent link

answered 14 Sep '17, 17:58

gchq's gravatar image

accept rate: 36%

TRIM() may have helped:)

Note, LIKE patterns are limited to 126 bytes, and longer patterns should give a -606 SQLCODE.

(15 Sep '17, 03:49) 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: 14 Sep '17, 17:42

question was seen: 1,928 times

last updated: 15 Sep '17, 10:03