Unable to edit versioned views using a Python script utilizing arcpy.ArcSDESQLExecute().
上次发布: July 27, 2015ArcSDE/Enterprise Geodatabase
漏洞 ID 编号
NIM088264
已提交
January 19, 2013
上次修改时间
April 2, 2025
适用范围
ArcSDE/Enterprise Geodatabase
找到的版本
10.1
状态
Known Limit
经开发团队审核,已确定此问题与不受 Esri 控制的软件的已知限制有关。 问题的“其他信息”部分可能包含进一步说明。
附加信息
Correct syntax to include WITH RESULT SETS NONE and execute statements in batch (see 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.