<?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: Creating an ArcToolbox from a SQL sp with python? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748971#M57891</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben, thanks for your response. I'm making some progress, but have one question...do I need to change what is in quotations after sql= in your statement? I'm guessing that is a generic example, but what info needs to be written there? The stored procedure itself? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Jul 2014 20:04:28 GMT</pubDate>
    <dc:creator>JeremyBeasley</dc:creator>
    <dc:date>2014-07-31T20:04:28Z</dc:date>
    <item>
      <title>Creating an ArcToolbox from a SQL sp with python?</title>
      <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748969#M57889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody, let me start by saying my experience with python is limited, so excuse my ignorance if I ask something simple. My question is this...Is it possible to call on a SQL sp from a SQL server through python on my local machine and then create a toolbox that will return the desired results from the SQL sp just like it was executed on the SQL server? I'm trying to streamline my process and allow other users who are not familiar with SQL sp's to use these capabilities...TIA!&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jeremy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 16:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748969#M57889</guid>
      <dc:creator>JeremyBeasley</dc:creator>
      <dc:date>2014-07-31T16:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ArcToolbox from a SQL sp with python?</title>
      <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748970#M57890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this using the arcpy.ArcSDESQLExecute function.&amp;nbsp; Not a spatial SQL function but it work the same way and return your results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;workspace = "Database Connections\\GGE01000_ggadmin.sde"&lt;/P&gt;&lt;P&gt;conn = arcpy.ArcSDESQLExecute(workspace)&lt;/P&gt;&lt;P&gt;sql = "SELECT GROUPID FROM ggadmin.SCH_PAGE_DATA WHERE GROUPID IS NOT NULL AND ENABLE = 1 GROUP BY GROUPID;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GroupIDvalues = conn.execute(sql)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 16:23:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748970#M57890</guid>
      <dc:creator>BenSmith</dc:creator>
      <dc:date>2014-07-31T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ArcToolbox from a SQL sp with python?</title>
      <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748971#M57891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben, thanks for your response. I'm making some progress, but have one question...do I need to change what is in quotations after sql= in your statement? I'm guessing that is a generic example, but what info needs to be written there? The stored procedure itself? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 20:04:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748971#M57891</guid>
      <dc:creator>JeremyBeasley</dc:creator>
      <dc:date>2014-07-31T20:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ArcToolbox from a SQL sp with python?</title>
      <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748972#M57892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, after the SQL = should be your spatial query.  That was a generic flat query from DB2 and was there just as an example.  If you are calling a stored procedure then I would think it would be whatever commands you would use in the SQL tool you used to create and query when you created the SP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query in the example I sent is formatted for a basic select against a DB2 database.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 20:13:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748972#M57892</guid>
      <dc:creator>BenSmith</dc:creator>
      <dc:date>2014-07-31T20:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ArcToolbox from a SQL sp with python?</title>
      <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748973#M57893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cool, thanks. Basically what I'm doing with this SP is examining a feature and it's related features for a given condition and if that condition is met, it is shown in a table and used for reporting purposes. I've copied out the SP script that created the SP in SQL Sever Management Studio and placed it in the "" after SQL=.&amp;nbsp; When I run the execute script for my SP in SSMS, I'm required to provide a unique 'date' and a unique 'name'.&amp;nbsp; If possible I'm trying to create a toolbox that would allow others users who are not familiar with SQL the ability to execute this script and select the two requirements as drop down lists parameters. Is this possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 14:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748973#M57893</guid>
      <dc:creator>JeremyBeasley</dc:creator>
      <dc:date>2014-08-01T14:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ArcToolbox from a SQL sp with python?</title>
      <link>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748974#M57894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know there are some esri examples in the help that describe creating a toolbox function that will take user input values.  To pass variable such as user input to the SQL function I would do something like this with the SQL string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;userDATE = (input from toolbox)&lt;/P&gt;&lt;P&gt;userNAME = (input from toolbox)&lt;/P&gt;&lt;P&gt;SQL = "SELECT  WHERE DATE = '%s' AND NAME = '%s';" %(userDATE, userNAME)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ‘%S’ takes the variables userDATE and userNAME in order and substitutes them into the string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 15:58:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-an-arctoolbox-from-a-sql-sp-with-python/m-p/748974#M57894</guid>
      <dc:creator>BenSmith</dc:creator>
      <dc:date>2014-08-01T15:58:04Z</dc:date>
    </item>
  </channel>
</rss>

