<?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 arcpy.select invalid sql statement in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243322#M18906</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;The following script is giving a syntax errror on the arcpy.Select line. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried various combinations of Quotes but I still get the invalid sql statement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PropertyNew = "M:\\GIS\\KMZ Irrigation East\\PropertyNew.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OwnerPropertyShp = "M:\\GIS\\KMZ Irrigation East\\OwnerProperty.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Select&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Select_analysis(PropertyNew, OwnerPropertyShp, "[PARCEL_SPI] = '2003\\PP2679'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "M:\GIS\KMZ Irrigation East\owner.py", line 19, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Select_analysis(PropertyNew, OwnerPropertyShp, "[PARCEL_SPI] = '2003\\PP2679'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 88, in Select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Select).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2013 19:00:01 GMT</pubDate>
    <dc:creator>BobMCkay</dc:creator>
    <dc:date>2013-02-26T19:00:01Z</dc:date>
    <item>
      <title>arcpy.select invalid sql statement</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243322#M18906</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;The following script is giving a syntax errror on the arcpy.Select line. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried various combinations of Quotes but I still get the invalid sql statement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PropertyNew = "M:\\GIS\\KMZ Irrigation East\\PropertyNew.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OwnerPropertyShp = "M:\\GIS\\KMZ Irrigation East\\OwnerProperty.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Select&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Select_analysis(PropertyNew, OwnerPropertyShp, "[PARCEL_SPI] = '2003\\PP2679'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "M:\GIS\KMZ Irrigation East\owner.py", line 19, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Select_analysis(PropertyNew, OwnerPropertyShp, "[PARCEL_SPI] = '2003\\PP2679'")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 88, in Select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An invalid SQL statement was used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Select).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 19:00:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243322#M18906</guid>
      <dc:creator>BobMCkay</dc:creator>
      <dc:date>2013-02-26T19:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.select invalid sql statement</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243323#M18907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are using personal geodatabase syntax on a shapefile. Try this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;""""PARCEL_SPI" = '2003\PP2679'"""&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are still having issues try making your selection manually in ArcMap using select by attributes and copy the syntax that works there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 20:16:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243323#M18907</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-02-26T20:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.select invalid sql statement</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243324#M18908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That worked fine. I thank you sincerely, but what does the deep imbedding in double quotes do? Can I also pass the string in as a Python argument i.e. how would I deal with all the quotes in a variable. Could I do something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;,""""&amp;amp;var1&amp;amp;''''''"). Once again many thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 22:54:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243324#M18908</guid>
      <dc:creator>BobMCkay</dc:creator>
      <dc:date>2013-02-26T22:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.select invalid sql statement</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243325#M18909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The triple quotes ensure everything inside is a string so you don't have to use escape characters when you want to use multiple quotations inside your string. You can pass variables to it using standard string substitution just like any other string, though it wouldn't be necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;"""{0}""".format(some_variable)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2013 12:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-select-invalid-sql-statement/m-p/243325#M18909</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-02-27T12:18:08Z</dc:date>
    </item>
  </channel>
</rss>

