Query Syntax Error: There was an error with the expression. 1: near "ESCAPE": syntax error

Applies To
Product(s): Bentley WaterGEMS, Bentley SewerGEMS, Bentley CivilStorm, Bentley StormCAD, Bentley PondPack, Bentley StormCAD, Bentley HAMMER, Bentley WaterCAD
Version(s): 08.11.XX.XX
Environment: N/A
Area: Other
Subarea:
Original Author: Mark Pachlhofer, Bentley Technical Support Group

 

Problem Description

When I go to run a query I get the following error message: "Query Syntax Error: There was an error with the expression. 1: near "ESCAPE": syntax error"

Background

The problem was found using a SQL statement with two % wildcard characters in it. The original statement was:

Physical_PipeMaterial LIKE '%PN%'. This statement causes a problem, however, because it does not use an escape character to let SQL know to stop looking for a unlimited amount of characters before it gets to the 'PN%' part of the string. Using a escape character let's SQL's logic know when to stop.

Steps to Resolve

Option 1 - Use the proper SQL syntax with an escape sequence

Something like this should work:  Physical_PipeMaterial LIKE '%/PN%' ESCAPE '/'

Option 2 - Uncheck the "Validate on OK" checkbox before you hit ok

  • Created by
  • When: Mon, May 19 2014 12:12 PM
  • Last revision by
  • When: Mon, May 19 2014 12:42 PM
  • Revisions: 2
  • Comments: 0
Anonymous
Recommended
Related