1

How can I create an ArcToolbox that executes a SQL stored procedure and asks the user for two inputs?

As it stands now, I have to log in to my SQL server and run an execute statement for the stored procedure that requires two inputs from the user.

I'm trying to streamline my process to give people with no SQL experience the ability to generate these data through an ArcToolbox.

  • Would you be able to edit your question so that it contains just the more important question of your two as per the Tour, please? You can always research/ask the other one separately. – PolyGeo Aug 1 '14 at 23:38
1

I think your best bet would be to create a Python script that takes the inputs and calls the SQL stored procedure through something like pyODBC (or pyMSSQL). Then attach the script to a script tool with the input indexes in the correct order.

One missing piece that I can think of would be returning the results to ArcMap directly. Otherwise, you may have to use the "Add Data" button (or "File->Add Query Layer") to load your result into your ArcMap session.

Another alternative, if you have ArcGIS Server installed, would be to create a geoprocessing service and allow users to connect directly to the GP Service.

  • thanks. The data returned from the SQL stored procedure would be tabular and I'd want to export it to some sort of file if I was able to create a toolbox, so I'm hoping that won't be a big issue. Have you had any experience with the ArcSDESQLExecute class? link – GIS_VDawg Aug 4 '14 at 19:50
  • I have not used ArcSDESQLExecute, but that seems like the way to start if you have an ArcSDE database. – RyanKDalton Aug 4 '14 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.