<?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 How to execute a SQL Server stored procedure with ArcPy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221872#M17130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to execute a Ms SQL Server stored procedure using&amp;nbsp;Arcpy.&amp;nbsp; Any source code samples that will hep me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Jan 2019 16:11:56 GMT</pubDate>
    <dc:creator>JoseSanchez</dc:creator>
    <dc:date>2019-01-02T16:11:56Z</dc:date>
    <item>
      <title>How to execute a SQL Server stored procedure with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221872#M17130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to execute a Ms SQL Server stored procedure using&amp;nbsp;Arcpy.&amp;nbsp; Any source code samples that will hep me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2019 16:11:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221872#M17130</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2019-01-02T16:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a SQL Server stored procedure with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221873#M17131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/classes/arcsdesqlexecute.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/classes/arcsdesqlexecute.htm"&gt;ArcSDESQLExecute—ArcPy classes | ArcGIS Desktop&lt;/A&gt; may work, it depends on a couple of factors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why do you have to execute the stored procedure in "ArcPy?"&amp;nbsp; Why not just connect to it using a Python wrapper for SQL Server?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2019 19:54:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221873#M17131</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-01-02T19:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a SQL Server stored procedure with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221874#M17132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was looking for an option to run a Ms&amp;nbsp;SQL Update statement because updating records using&amp;nbsp; arcpy.da.UpdateCursor&amp;nbsp; is too slow.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;The first option was to add the SQL code in a stored procedure and run the stored procedure.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;The second option, I just copy/pasted&amp;nbsp;the code sample (&lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/classes/arcsdesqlexecute.htm"&gt;http://pro.arcgis.com/en/pro-app/arcpy/classes/arcsdesqlexecute.htm&lt;/A&gt;) , added an Update SQL Statement to variable "sql_statement" , ran the code and&amp;nbsp;it worked.&lt;BR /&gt;&lt;A&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; sql_statement = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;" UPDATE [owner].[Property] "&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"SET [FOLIO] = APP.TCIS_GIS.FOLIO "&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;……..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; sql_statement_list = sql_statement.split(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;";"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;egdb_return = egdb_conn.execute(sql)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2019 20:59:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221874#M17132</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2019-01-02T20:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a SQL Server stored procedure with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221875#M17133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad you could get something working.&amp;nbsp; Just a note of caution, ArcSDESQLExecute doesn't recognize versions, so you will be making updates to base tables unless your SQL is using versioned views.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2019 23:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221875#M17133</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-01-02T23:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a SQL Server stored procedure with ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221876#M17134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case layers are not versioned, so ArcSDESQLExecute runs fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2019 12:48:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-execute-a-sql-server-stored-procedure-with/m-p/221876#M17134</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2019-01-03T12:48:28Z</dc:date>
    </item>
  </channel>
</rss>

