AnsweredAssumed Answered

Delete all table records with special character, # , '

Question asked by 2CQuiker on May 18, 2020
Latest reply on May 19, 2020 by blake.terhune

I have a feature class table that i need to delete the rows with special characters of # , ' or other certain special characters. I have tried the following but nothing happens so I am not coding it correctly, I am in need of some help please.

 

A2 = "ArcSDE Personal Server/featureclass"

# sql SubName LIKE '%#'
with arcpy.da.UpdateCursor(A2 , ["OBJECTID","Field"]) as cursor: 
    for row in cursor:     
        if row[1] in ["'", "#"]:
            print ("Deleting record: 'OBJECTID' = {}".format(row[0]))
            cursor.deleteRow()

Outcomes