<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem Executing arcpy.Select_analysis in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588387#M46118</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Johan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that the main issue here is FID's field type: it is technically of type 'Object ID' which is queried like an integer field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So a query referencing it would look like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;'"FID" = 3'&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;without any additional quotes (in contrast to string fields, where you would need those quotes.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The examples on ArcGIS' &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000800000005000000.htm"&gt;Select Analysis page&lt;/A&gt;&lt;SPAN&gt; seem to all be referencing string fields, unfortunately. The &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s50000002t000000.htm"&gt;Building SQL Queries page&lt;/A&gt;&lt;SPAN&gt; has more info on how to structure queries, and features a section dealing with searching for numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Sep 2011 13:59:12 GMT</pubDate>
    <dc:creator>MarcNakleh</dc:creator>
    <dc:date>2011-09-22T13:59:12Z</dc:date>
    <item>
      <title>Problem Executing arcpy.Select_analysis</title>
      <link>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588386#M46117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;currently trying to learn Python to do some scripting but unfortunately I keep getting an error message. Below are the scripts I have used, followed by the actual Error Message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "C:/GTZ Data/PEN_IUCN/PEN_IUCN"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in_features = "AMPHANURA_RBS_Clip"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_feature_class = "C:/IUCN Data/AMPHANURA/AMPHANURA_RBS_Clip_FID3.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where_clause = '"FID" = \'3\''&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Execute Select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Select_analysis(in_features, out_feature_class, where_clause)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AS WELL AS&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "C:/GTZ Data/PEN_IUCN/PEN_IUCN"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in_features = "C:/IUCN Data/AMPHANURA/AMPHANURA_RBS_Clip.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;out_feature_class = "C:/IUCN Data/AMPHANURA/AMPHANURA_RBS_Clip_FID3.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where_clause = '"FID" = \'3\''&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Execute Select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Select_analysis(in_features, out_feature_class, where_clause)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 999999: Error executing function. An invalid SQL statement was used. An invalid SQL statement was used. Failed to execute (Select).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks a lot...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Johan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 13:40:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588386#M46117</guid>
      <dc:creator>JohanOldekop</dc:creator>
      <dc:date>2011-09-22T13:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Executing arcpy.Select_analysis</title>
      <link>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588387#M46118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Johan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that the main issue here is FID's field type: it is technically of type 'Object ID' which is queried like an integer field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So a query referencing it would look like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;'"FID" = 3'&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;without any additional quotes (in contrast to string fields, where you would need those quotes.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The examples on ArcGIS' &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000800000005000000.htm"&gt;Select Analysis page&lt;/A&gt;&lt;SPAN&gt; seem to all be referencing string fields, unfortunately. The &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s50000002t000000.htm"&gt;Building SQL Queries page&lt;/A&gt;&lt;SPAN&gt; has more info on how to structure queries, and features a section dealing with searching for numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 13:59:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588387#M46118</guid>
      <dc:creator>MarcNakleh</dc:creator>
      <dc:date>2011-09-22T13:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Executing arcpy.Select_analysis</title>
      <link>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588388#M46119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ran the script with the changes and it worked!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for the help...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Johan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 15:02:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-executing-arcpy-select-analysis/m-p/588388#M46119</guid>
      <dc:creator>JohanOldekop</dc:creator>
      <dc:date>2011-09-22T15:02:28Z</dc:date>
    </item>
  </channel>
</rss>

