<?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: ArcSDESQLExecute is not able to handle unique identifiers in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1238624#M66231</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Despite the fact that unique identifiers are supported&lt;/STRONG&gt;, I went for a casting approach&lt;/P&gt;&lt;PRE&gt;database = &lt;SPAN class=""&gt;'C:\\Installation\\updm.sde'&lt;/SPAN&gt;

egdb_conn = arcpy.ArcSDESQLExecute(database)
&lt;SPAN class=""&gt;# Getting the ID's froma table&lt;/SPAN&gt;
sql_clause = &lt;SPAN class=""&gt;"SELECT CAST(PROJECT_ID AS VARCHAR(100)) from DataOwner.My_PROJECTS;"&lt;/SPAN&gt;

query_return = egdb_conn.execute(sql_clause)

&lt;SPAN class=""&gt;# Whatever operation you want to do with the results, in this case&lt;/SPAN&gt;
&lt;SPAN class=""&gt;# is just the verification of how many results, but they will be &lt;/SPAN&gt;
&lt;SPAN class=""&gt;# iterated later&lt;/SPAN&gt;

&lt;SPAN class=""&gt;len&lt;/SPAN&gt;(query_return)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* by the way the semicolon does not make any difference.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 07:59:32 GMT</pubDate>
    <dc:creator>Cristian_Galindo</dc:creator>
    <dc:date>2022-12-07T07:59:32Z</dc:date>
    <item>
      <title>ArcSDESQLExecute is not able to handle unique identifiers</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1237162#M66204</link>
      <description>&lt;P&gt;Using ArcGIS Pro 2.9.5 I found that&amp;nbsp;ArcSDESQLExecute is not able to handle unique identifiers in a table.&lt;/P&gt;&lt;P&gt;I tried to run the following Script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;database = 'C:\\Installation\\updm.sde'

egdb_conn = arcpy.ArcSDESQLExecute(database)
sql_clause = "SELECT PROJECT_ID from DataOwner.My_PROJECTS;"
print(sql_query)

query_return = egdb_conn.execute(sql_clause)

len(query_return)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the table My_PROJECTS has a column PROJECT_ID defined as a uniqueidentifier., the result odf the execution is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
In  [39]:
Line 12:    query_return = egdb_conn.execute(sql_clause)

File C:\ArcGISPro\Resources\ArcPy\arcpy\arcobjects\arcobjects.py, in execute:
Line 44:    return convertArcObjectToPythonObject(self._arc_object.Execute(*gp_fixargs(args)))

AttributeError: ArcSDESQLExecute: StreamBindOutputColumn ArcSDE Error -65 Invalid pointer argument to function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 09:38:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1237162#M66204</guid>
      <dc:creator>Cristian_Galindo</dc:creator>
      <dc:date>2022-12-02T09:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDESQLExecute is not able to handle unique identifiers</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1237217#M66205</link>
      <description>&lt;P&gt;Try without the ending semicolon in the SQL statement.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 14:49:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1237217#M66205</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2022-12-02T14:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDESQLExecute is not able to handle unique identifiers</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1237571#M66211</link>
      <description>&lt;P&gt;Thanks for the suggestion.&lt;/P&gt;&lt;P&gt;As a matter of fact I did it before of making the post, but I did it again just to be able to copy and paste the output from the execution:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
In  [48]:
Line 7:     query_return = egdb_conn.execute(sql_clause)

File C:\ArcGISPro\Resources\ArcPy\arcpy\arcobjects\arcobjects.py, in execute:
Line 44:    return convertArcObjectToPythonObject(self._arc_object.Execute(*gp_fixargs(args)))

AttributeError: ArcSDESQLExecute: StreamBindOutputColumn ArcSDE Error -65 Invalid pointer argument to function
---------------------------------------------------------------------------&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I already state in my original post this happens with columns defined as unique identifier. If I try to make the query to an INT, VARCHAR or DECIMAL column, the query is performed with out any issues.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2022 09:38:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1237571#M66211</guid>
      <dc:creator>Cristian_Galindo</dc:creator>
      <dc:date>2022-12-04T09:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDESQLExecute is not able to handle unique identifiers</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1238624#M66231</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Despite the fact that unique identifiers are supported&lt;/STRONG&gt;, I went for a casting approach&lt;/P&gt;&lt;PRE&gt;database = &lt;SPAN class=""&gt;'C:\\Installation\\updm.sde'&lt;/SPAN&gt;

egdb_conn = arcpy.ArcSDESQLExecute(database)
&lt;SPAN class=""&gt;# Getting the ID's froma table&lt;/SPAN&gt;
sql_clause = &lt;SPAN class=""&gt;"SELECT CAST(PROJECT_ID AS VARCHAR(100)) from DataOwner.My_PROJECTS;"&lt;/SPAN&gt;

query_return = egdb_conn.execute(sql_clause)

&lt;SPAN class=""&gt;# Whatever operation you want to do with the results, in this case&lt;/SPAN&gt;
&lt;SPAN class=""&gt;# is just the verification of how many results, but they will be &lt;/SPAN&gt;
&lt;SPAN class=""&gt;# iterated later&lt;/SPAN&gt;

&lt;SPAN class=""&gt;len&lt;/SPAN&gt;(query_return)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* by the way the semicolon does not make any difference.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 07:59:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-is-not-able-to-handle-unique/m-p/1238624#M66231</guid>
      <dc:creator>Cristian_Galindo</dc:creator>
      <dc:date>2022-12-07T07:59:32Z</dc:date>
    </item>
  </channel>
</rss>

