Skip to main content

Timeline for Export to SHP with ArcPy with query

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Sep 19, 2014 at 11:32 vote accept Sigster
Sep 19, 2014 at 11:32 comment added Sigster Fix this where = '"postalcode" = \'8000\'' Regards Sigster
Sep 17, 2014 at 15:04 comment added Sigster No this is field I already have in the shp file with your sample it was in endless loop so I query like this with the postalcode it work well and no problem with but if I use this on areacode I get error area_code is Type String import arcpy fc = "C:\\Samples\\shipefile.shp" where = """"postalcode" = 1100""" arcpy.FeatureClassToFeatureClass_conversion(fc, "C:\\Samples\\ut", "1100_street.shp", where) the error if I query area_code what is TypeString raise e ExecuteError: ERROR 999999: Error executing function. An invalid SQL statement was used. An invalid SQL
Sep 17, 2014 at 13:24 comment added Aaron @Sigster If you are querying a new field, you should add it to the field list. For example: ["SHAPE@", "areacode", "postalcode"]. You can then reference the new postalcode field by calling row[2].
Sep 17, 2014 at 10:12 comment added Sigster Thanks this works for me But when I search for areacode I it is ok but when I use it on postalcode I get error areacode is Long and postalcode is String raise e ExecuteError: ERROR 999999: Error executing function. An invalid SQL statement was used. An invalid SQL statement was used. Failed to execute
Sep 16, 2014 at 14:48 history edited Aaron CC BY-SA 3.0
Added information about querying data
Sep 16, 2014 at 13:20 history edited Aaron CC BY-SA 3.0
added 61 characters in body
Sep 16, 2014 at 13:07 history answered Aaron CC BY-SA 3.0