I am trying to use Search Cursor on Data. Following code is running for Numeric field without any error.

for i in cursor:
     print i[1]

But when I try the same thing on string field, I am getting following error Runtime error Traceback (most recent call last):

File "", line 1, in RuntimeError: An invalid SQL statement was used.

My Code for string field

cursor=arcpy.da.SearchCursor("majroads","*",""""CLASS"="County Road""")
for i in cursor:
     print i[1]
  • 2
    I think you need to put single quotes around Country Road – PolyGeo May 11 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.