Code Gallery
ExecuteSQL Command for ArcMap
|
This command may be used to executeSQL against a connected database. It uses the ArcObjects IWorkspace.ExecuteSQL method.
It is very useful in starting DBMS tracing from ArcMap. Usage: -Add data to ArcMap -Select a feature layer -Click the command button -Enter sql to execute -Click ok New version uses a text file (%TEMP%\execSQL_dotNET_History_.txt or one of your choice) to track history of sql you run. Example SQL to start a trace: ORACLE: alter session set events '10046 trace name context forever, level 12' SQLServer: master..sp_trace_setstatus 1 Informix: set explain on
|
|
Report Inappropriate Content: This Code Gallery is intended for the free exchange of code related to ESRI software products. Let us know if this entry is inappropriate (e.g., a download for a commercial product).

It worked. posted by rprader on Jul 06, 2009 5:38 PM
Simple way to enable a user to run thier own trace or any other sql needed in your workflow. Would be nice if in the future it had a history of commands or storable SQL options for common commands. Setup was a breeze: 1) downloaded file 2) grabbed the dll and pdb and tlb out of the release folder, placed into a folder of my own. 3) registered it with: C:\Batch_Files\ExecuteSQL>regasm /codebase C:\Batch_Files\ExecuteSQL\execSQL_dot net.dll /tlb 4)Found the button available: Right click on tool bar Choose "Customize" choose the "Command" tab Under "SQL Tools" drag the ExecuteSQL button to an existing toolbar. I am using Oracle11G and ArcGIS Desktop 9.3.1, worked great.
Updated to track executed statement history posted by FoJo on Jul 21, 2009 5:51 PM
Thanks for the comments rprader! I've updated the code to now use a text file (%TEMP%\execSQL_dotNET_History_.txt) to track history of sql you run.
Updated to track executed statement history posted by FoJo on Jul 21, 2009 7:26 PM
The temp directory gets cleaned out periodically, so added the option to use a text file of your choice in case you want to keep it in another directory.
If you would like to post a comment, please login.