<?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 from arcpy of desktop 10.5 cannot read date column in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50574#M3993</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting, I am seeing the same thing using ArcMap 10.5.1 with Server 10.5.1 on SQL Server 2016, i.e., empty strings for date values and None for NULL.&amp;nbsp; I am not sure if it is a SQL Server issue, ArcGIS Server issue, or ArcGIS Desktop issue.&amp;nbsp; Seeing it is so straightforward and reproducible, I would open a Support case with Esri because something isn't working correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Jul 2017 12:40:26 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2017-07-04T12:40:26Z</dc:date>
    <item>
      <title>Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50571#M3990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We just recently upgraded from 10.3 to 10.5 and noticed a python script started failing. Based on investigation this class, arcsdesqlexeCute, is causing the issue. For some reason, the returned rows from using this class cannot read date values. Testing on 10.3 arcpy installation, this same workflow runs fine and returns date values properly. Just want to check if this is a bug. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2017 08:21:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50571#M3990</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2017-07-03T08:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50572#M3991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you update the clients (ArcMap, ArcEngine, etc...) to 10.5 or ArcGIS Server to 10.5?&amp;nbsp; What versions are the clients and servers running.&amp;nbsp; Also, were the database platforms upgraded at all in terms of DBMS version?&amp;nbsp; What DBMS type and version are you running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is helpful if you can post snippets that contain code that worked in 10.3 and code that doesn't work in 10.5 along with the specific error messages.&amp;nbsp; There isn't quite enough here for anyone to comment on specifically.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2017 15:40:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50572#M3991</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-07-03T15:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50573#M3992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The custom script is scheduled on a server where ArcGIS Server 10.5 is running. The test I did was done on Desktop 10.5 using featureclass\table on a 10.5 SDE and 2012 SQL server instance. Python install version we are using is 2.7.12. The code below is simple one to test,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;egdb = r'dataconnection\somedb.sde'&lt;/P&gt;&lt;P&gt;egdb_conn = arcpy.ArcSDESQLExecute(egdb)&lt;/P&gt;&lt;P&gt;sql = '''SELECT DATEFIELD FROM SOMEDATA'''&lt;/P&gt;&lt;P&gt;egdb_return = egdb.execute(sql)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the tuple returned by running this piece of code using the 10.5 setup (on server and desktop) will yield blank strings while when using just a 10.3 desktop install on a separate machine it extracts the datetime values correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2017 19:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50573#M3992</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2017-07-03T19:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50574#M3993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting, I am seeing the same thing using ArcMap 10.5.1 with Server 10.5.1 on SQL Server 2016, i.e., empty strings for date values and None for NULL.&amp;nbsp; I am not sure if it is a SQL Server issue, ArcGIS Server issue, or ArcGIS Desktop issue.&amp;nbsp; Seeing it is so straightforward and reproducible, I would open a Support case with Esri because something isn't working correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2017 12:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50574#M3993</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-07-04T12:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50575#M3994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for testing Joshua. The same issue was reproduced by our local ESRI distributor. Also just to correct myself, we are using&amp;nbsp;SQL 2016. I was thinking it was the database side but if I use 10.3 arcpy on the same database, I still get the timestamp values. &amp;nbsp;I'll update this thread once I get&amp;nbsp;more feedback&amp;nbsp;from our local distributors support team,.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2017 21:01:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50575#M3994</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2017-07-04T21:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50576#M3995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're currently preparing to&amp;nbsp;upgrade to 10.5.1 so I'm interested to see how this turns out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jul 2017 19:30:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50576#M3995</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2017-07-05T19:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50577#M3996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we spoke with our local ESRI vendor and currently the only solution is a workaround. On your sql query you can cast the date field as varchar. As string value the datestamp will be read. From here you would have to convert the string to datetime.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 08:57:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50577#M3996</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2017-08-02T08:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50578#M3997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having the exact same problem with older versions.&amp;nbsp;ArcGIS Server 10.4.1 and MSSQL 2012. I did cast to begin with but it slows down the query and the script takes 7 minutes to finish instead of a few seconds!! Is there a bug for this in ESRI??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50578#M3997</guid>
      <dc:creator>SvivaManager</dc:creator>
      <dc:date>2017-08-10T10:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50579#M3998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever tried using a different client instead of &lt;SPAN style="background-color: #ffffff;"&gt;arcpy.ArcSDESQLExecute&amp;nbsp;&lt;/SPAN&gt;to query the database? from different posts I found, people says it's not a good idea but I didn't tried it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50579#M3998</guid>
      <dc:creator>SvivaManager</dc:creator>
      <dc:date>2017-08-10T10:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50580#M3999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To clarify, the result of a&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; to_char(datecol,'YYYY-MM-DD')&lt;/SPAN&gt; is a&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; text&lt;/SPAN&gt; field (which is interpreted as a CLOB column, and caused an issue with ArcGIS 10.5 on PostgreSQL).&amp;nbsp; The&amp;nbsp; syntax to cast the string conversion would look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;SELECT&lt;/SPAN&gt; idcol&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;cast&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;to_char&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datecol&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'YYYY-MM-DD'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;varchar&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; datecol_str
&lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt;&amp;nbsp; mytable‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure the VARCHAR width is wide enough to hold the formatted date!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:57:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50580#M3999</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-12-10T21:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcsdesqlexecute from arcpy of desktop 10.5 cannot read date column</title>
      <link>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50581#M4000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're on Oracle 12c and ArcGIS 10.5.1 and have this problem. Querying a date field either returns an empty string or errors. Had to use &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&lt;A href="https://www.techonthenet.com/oracle/functions/to_char.php"&gt;to_char()&lt;/A&gt;&lt;/SPAN&gt; to convert the date to text&amp;nbsp;like Chris Pedrezuela and Vince Angelo mentioned.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 16:49:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcsdesqlexecute-from-arcpy-of-desktop-10-5-cannot/m-p/50581#M4000</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2017-10-25T16:49:23Z</dc:date>
    </item>
  </channel>
</rss>

