Select to view content in your preferred language

Using Select (Analysis) in Python

3652
2
03-16-2011 10:17 AM
abubadruddin
Deactivated User
I'm trying to use SELECT  (arcpy.analysis.Select) in Python and it does not work. Here is my code:
>>>arcpy.analysis.Select("USA","Test1",'"STATE_NAME" = "Maine"')

It gives me the following error message:
"Error executing function. A column was specified that does not exist. A column was specified that does not exist. Failed to execute (Select)"

Surprisingly, it works if I use a numeric field for the where_clause as shown below!
arcpy.analysis.Select("USA","Test1",'"POP2000" > 10000000')

Please let me know what I'm doing wrong.

Thanks.

AZM Badruddin
Tags (2)
0 Kudos
2 Replies
RDHarles
Regular Contributor
Put single quotes around the text and then surround the entire qry with double quotes, like this:

"STATE_NAME = 'Maine'"


p.s.  Apparently, there's more than one way to do it. Simply putting double quotes around "numeric" works also:
"POP2000 > 10000000"
0 Kudos
abubadruddin
Deactivated User
Thanks a lot. It works!
0 Kudos