I am troubles using the SelectLayerByAttribute() function for arcgis geoprocessing.
I have a layer and I want to select everything that matches on a particular attribute. I call MakeFeatureLayer() to create a layer, I run SelectLayerByAttribute() to select what I want, and then I run CopyFeatures() to save that layer into the database.
However, after the copyfeatures() call, nothing is saved and I have empty layers.
Is there something I'm missing?
I'm using python and arcgisscripting module for geoprocessing. My code below:
gp.MakeFeatureLayer_management(target_layer, "lyr") gp.SelectLayerByAttribute_management("lyr", "NEW_SELECTION", "\"my_attribute\" = 5 " ) # Write the selected features to a new featureclass gp.CopyFeatures_management("lyr", output)