Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several hundred geodatabase feature classes which all have the exact same fields. I need to go through each of those feature classes and delete any records which match an SQL query (the same SQL query can be applied to all the feature classes). Alternatively, I could export them all to new feature classes, keeping the records I want. In ArcCatalog I can export them singly using an SQL query to specify which records get exported, but the SQL statement option isn't available when you want to export multiple layers simultaneously (using "Feature Class to Geodatabase (multiple)").

share|improve this question
What I ended up doing was using the "Feature Class to Feature Class (single)" tool in batch mode, that let me use an SQL query for each feature class. – Dan C Sep 23 '11 at 20:28
That was going to be my advice too - although I was instead testing the Select tool in batch mode. – PolyGeo Sep 23 '11 at 21:48
This would have been my way; simply copy over the columns you do want to a new FC, less code and less drama. Sometimes working with cursors can be laborious. – Hairy Sep 26 '11 at 6:53
up vote 2 down vote accepted

I would try doing this using the Select (Analysis) tool:

Extracts features from an input feature class or input feature layer, typically using a select or Structured Query Language (SQL) expression and stores them in an output feature class.

in batch mode:

To use batch, right-click a tool and click Batch. This opens the batch dialog box with one row of the batch grid

share|improve this answer

One way to automate the processing of this would be with Python by working through a list of the feature classes, and the using an updatecursor/deleteRow statement to delete the unneeded records.

import arcpy

workspace = r"c:\yourworkspace\yourgeodatabase.gdb"  #assuming file geodatabase
arcpy.env.workspace = workspace

#Part 1 -- create list of feature classes in your geodatabase...
#assuming all featureclasses within the geodatabase are of interest for the query -- otherwise specify a wildcard below

featureclasslist = arcpy.ListFeatureClasses()

#now run a loop on feature classes in the list
for featureclass in featureclasslist:

 #Part 2 -- deleting the records specified in your sql query. There are two approaches:

 # option1:
    your_query = " \"yourfield\" = 'your_value' "  #enter your sql query here

    rows = arcpy.UpdateCursor(featureclass, your_query)
    for row in rows:

    # or option 2

    rows = arcpy.UpdateCursor(featureclass)
    for row in rows:
        if row.getValue("Yourfield") == 'your_value':

More here on listing featureclasses:

and on the updatecursor/deleteRow statement:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.