laptop and a wrench

Bug

Unable to edit versioned views using a Python script utilizing arcpy.ArcSDESQLExecute().

Last Published: July 27, 2015 ArcSDE/Enterprise Geodatabase
Bug ID Number NIM088264
SubmittedJanuary 19, 2013
Last ModifiedApril 2, 2025
Applies toArcSDE/Enterprise Geodatabase
Version found10.1
StatusKnown Limit

Additional Information

Correct syntax to include WITH RESULT SETS NONE and execute statements in batch (see workaround)

Workaround

The error reported can be avoided by adding WITH RESULT SETS NONE:eGIS_Conn.execute("EXEC dbo.edit_version @name = 'dbo.Ch1', @edit_action=1 WITH RESULT SETS NONE ")However, because these versioned view stored procedures issue a hard commit to commit all the nested transactions, another error can be encountered unless the entire set of SQL is executed in batch:eg: eGIS_Conn = arcpy.ArcSDESQLExecute(eGIS)eGIS_Conn.execute("EXEC dbo.set_current_version @version_name = 'dbo.Ch1' ; EXEC dbo.edit_version @name = 'dbo.Ch1', @edit_action=1 WITH RESULT SETS NONE; EXEC dbo.edit_version @name = 'dbo.Ch1', @edit_action=2 WITH RESULT SETS NONE")The reason is that ArcSDE will by default always be in transaction.If the execute statements are not put in batch (like shown above) the transaction count will be different before and after execute the edit_version stored procedure and you will encounter the following error.Runtime errorTraceback (most recent call last):File "<string>", line 6, in <module>File "<a href="file:c:/arcgis/arcpy/arcpy/arcobjects/arcobjects.py" target="_blank">c:\arcgis\arcpy\arcpy\arcobjects\arcobjects.py</a>", line 27, in executereturn convertArcObjectToPythonObject(self._arc_object.Execute(*gp_fixargs(args)))AttributeError: ArcSDESQLExecute: StreamExecute ArcSDE Extended error 266 [Microsoft][SQL Server Native Client 11.0][SQL Server]Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.

Steps to Reproduce

Bug ID: NIM088264

Software:

  • ArcSDE/Enterprise Geodatabase

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options