I am trying to iterate through a list of where clauses as such:

for vc in vcList:
    print (vc)
""""D_Zone" =  1"""
""""D_Zone" =  2"""
""""D_Zone" =  3"""
""""D_Zone" =  4"""
""""D_Zone" =  5"""

for each iteration I want to use a for loop to execute aFeatureClassToFeatureClass_conversion using the iterable as the where clause:

for vc in vcList:
    oName = base + "_" + str(count)
    arcpy.conversion.FeatureClassToFeatureClass('Origins_Geocoded', oPath, oName, vc)
    count += 1

but I am getting an invalid SQL error:

An invalid SQL statement was used. [SELECT * FROM Origins_Geocoded WHERE """"D_Zone" =  1"""]

The value being queried is short numeric. Seems to be consistent with the first example from Esri:


What must I do to construct a proper where clause?

1 Answer 1


I changed the clause to only have double quotes around fieldname and sigle quotes to contain the cluse:

['"D_Zone" = 1', '"D_Zone" = 2', '"D_Zone" = 3', '"D_Zone" = 4', '"D_Zone" = 5', '"D_Zone" = 6']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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