<?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: Invalid SQL syntax: SQLSTATE=42601 in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1031243#M6997</link>
    <description>&lt;P&gt;Good call.&amp;nbsp; The intertubes says the "SQLSTATE=42601" error is associated with IBM DB2.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
    <pubDate>Sat, 27 Feb 2021 01:24:36 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2021-02-27T01:24:36Z</dc:date>
    <item>
      <title>Invalid SQL syntax: SQLSTATE=42601</title>
      <link>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1030495#M6995</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am trying to use arcpy.da.SearchCursor to return a row, and get the extent (min, max).&lt;/P&gt;&lt;P&gt;I used the ESRI example:&amp;nbsp;&lt;SPAN&gt;Use SQL TOP to limit the number of records to return.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Use SQL TOP to sort field values
for row in arcpy.da.SearchCursor(fc, fields, sql_clause=('TOP 3', None)):&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code: gets an error at 'for row in arcpy.da...'&lt;/P&gt;&lt;P&gt;RuntimeError: Invalid SQL syntax [ERROR: syntax error at or near "3"??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any pointers,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for dirpath, dirnames, filenames in arcpy.da.Walk(workspace, topdown=True, datatype=data_type): 
    #datasets = [''] + datasets if datasets is not None else []
    for filename in filenames:
        #print(filename)  ### Prints the path + name
        fc_name = filename.split('.')[-1]
        print(fc_name)

		sc = arcpy.da.SearchCursor(r"D:\Users\me\db.sde\fc",["polygon"])
		for row in sorted(arcpy.da.SearchCursor(sc, ["Shape@"], sql_clause=('TOP 1', None)):
		print(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an error&amp;nbsp;@&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 15:54:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1030495#M6995</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2021-02-25T15:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid SQL syntax: SQLSTATE=42601</title>
      <link>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1030893#M6996</link>
      <description>&lt;P&gt;Hi Clive,&lt;/P&gt;&lt;P&gt;Is your database and SQL Server&amp;nbsp; or MS Access database? &lt;SPAN&gt;TOP is only supported by SQL Server and MS Access databases.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 05:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1030893#M6996</guid>
      <dc:creator>DavinWalker2</dc:creator>
      <dc:date>2021-02-26T05:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid SQL syntax: SQLSTATE=42601</title>
      <link>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1031243#M6997</link>
      <description>&lt;P&gt;Good call.&amp;nbsp; The intertubes says the "SQLSTATE=42601" error is associated with IBM DB2.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Sat, 27 Feb 2021 01:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/invalid-sql-syntax-sqlstate-42601/m-p/1031243#M6997</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-02-27T01:24:36Z</dc:date>
    </item>
  </channel>
</rss>

