Knowledge Base - Technical Articles


Technical Article   Error:  One or more layers failed to draw: An invalid SQL statement was used. [ ]

Article ID: 22547
Software:  ArcGIS - ArcEditor 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1, 10 ArcGIS - ArcInfo 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1, 10 ArcGIS - ArcView 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1, 10
Platforms:  Windows NT 4.0, 2000, XP, 2003Server, Vista, 2008Server, Win 7

Error Message

When labeling features with 'define classes of features and label each class differently', the following error message is returned:

"One or more layers failed to draw: An invalid SQL statement was used. [ ]"

and no labels appear on the map.

Cause

On the Layer Properties dialog box > Labels tab, multiple label classes can be defined for a single layer in the Method drop-down list. Each label class is defined by a SQL query. If this query has invalid syntax, this error message appears and labels are not drawn.

It is possible to get label classes with invalid SQL syntax by using the Get Symbology Classes option. Clicking this button automatically builds label classes to match the symbology classes. The above error message can occur because of the following reasons:

1. A comma is being used as the decimal delimiter, such as in German, French, Italian, Lithuanian, etc.

2. The symbology is classified, for example, graduated colors or graduated symbols.

3. The class breaks are decimal delimited. For example, the value field is a double, or normalizing is used to create breaks that contain decimal delimiters.

Solution or Workaround

Correct the invalid SQL syntax by editing the query for each label class.

  1. Open the 'ArcMap Layer Properties' dialog box.
  2. Select the 'Labels' tab.
  3. Select a label class from the 'Class' drop-down list.
  4. Click the 'SQL Query' button to open the 'Query Builder' dialog box.
  5. Modify the SQL query.

     For the scenario stated in the cause, use a period (.) instead of a comma (,) as a decimal delimiter.

    Incorrect:
    "AREA" > 66,063000 AND "AREA" <= 70812,056000

    Correct:
    "AREA" > 66.063000 AND "AREA" <= 70812.056000

  6. Click 'Verify' to insure the SQL state is valid.
  7. Click 'OK' to close the 'Query Builder' dialog box.
  8. Repeat Steps 3 through 7 for each label class.
  9. Make sure there is a check mark next to the 'Label' features in this layer option.
  10. Click 'OK' to close the 'Layer Properties' dialog box and draw the labels.

Related Information

  • One or more layers failed to draw
    When attempting to draw a layer, ArcMap returns the following error: "One or more layers failed to draw:..." After dismissing this error message, either a layer or the layer's labels do not draw. This message may also appear when trying to o...
  • One or more layers failed to draw: General function failure
    Attempting to display flow arrows on a geometric network in ArcMap returns: {CODE}One or more layers failed to draw: General function failure [EdgeFeatureClassName] Syntax error (comma) in query expression 'SHAPE_Length >= 123,56789' {/CODE}
  • One or more layers failed to draw: The table was not found. [layer]
    Converting labels to annotation returns: Error One or more layers failed to draw: The table was not found. [layer] The Microsoft Jet database engine cannot find the input table or query ''. Make sure it exists and that its name is sp...
  • One or more layers failed to draw: Invalid SQL syntax[]
    Clicking the OK button on the Add Route Events or Display Route Events dialog to display events on ArcSDE for Coverages data produces this error: "One or more layers failed to draw: Invalid SQL syntax[]"

Created: 5/23/2002
Last Modified: 9/20/2010

If you would like to post a comment, please login