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:42

gchq's gravatar image

gchq
1816921
accept rate: 33%

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): http://dcx.sap.com/index.html#sqla170/en/html/80e18e026ce21014b92ae2d6bf718050.html

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, 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:58

gchq's gravatar image

gchq
1816921
accept rate: 33%

TRIM() may have helped:)

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

(15 Sep, 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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×91

question asked: 14 Sep, 17:42

question was seen: 111 times

last updated: 15 Sep, 10:03