<?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: SQL Error: &amp;quot;Not currently editing a version, cannot stop edit.&amp;quot; in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767238#M751</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I got the scheduled job to run correctly once I created the version&amp;nbsp;and just had sql update it. Although the data was updated correctly, the errors included:&lt;/P&gt;&lt;P&gt;"Not currently editing a version&amp;lt;c/&amp;gt; cannot stop edit. [SQLSTATE 42000] (Error 50000).&amp;nbsp; The step failed."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice to get the job to run without these errors so the job history isn't filled with red x's. Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC dbo.set_current_version 'WMMUpdate';&lt;BR /&gt;EXEC dbo.edit_version 'WMMUpdate', 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MERGE ElectricModel.dbo.Transformer_evw&lt;BR /&gt;USING WMMExport.dbo.TRANSFORMER&lt;BR /&gt;ON ElectricModel.dbo.Transformer_evw.GUID_WMM = WMMExport.dbo.TRANSFORMER.wm_ElementGuid&lt;BR /&gt;WHEN MATCHED THEN&lt;BR /&gt;UPDATE SET ElectricModel.dbo.Transformer_evw.esElementName= WMMExport.dbo.TRANSFORMER.wmElementName;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;EXEC dbo.edit_version 'WMMUpdate', 2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Feb 2018 15:24:33 GMT</pubDate>
    <dc:creator>AdelaideZumwalt1</dc:creator>
    <dc:date>2018-02-22T15:24:33Z</dc:date>
    <item>
      <title>SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767234#M747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used this script for a couple months on another database but can't seem to get it to work on the new database. I keep running into the following error:&amp;nbsp;"Not currently editing a version, cannot stop edit." even though my step specifically starts and stops the edit session. What am I missing? The version is being created, I can see it in ArcMap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC dbo.create_version 'dbo.DEFAULT', 'WMMUpdate', 1, 1, 'This version contains data pushed from WMMExport to ElectricModel';&lt;BR /&gt;EXEC dbo.set_current_version 'WMMUpdate';&lt;BR /&gt;EXEC dbo.edit_version 'WMMUpdate', 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MERGE ElectricModel.dbo.Transformer_evw&lt;BR /&gt;USING WMMExport.dbo.TRANSFORMER&lt;BR /&gt;ON ElectricModel.dbo.Transformer_evw.GUID_WMM = WMMExport.dbo.TRANSFORMER.wm_ElementGuid&lt;BR /&gt;WHEN MATCHED THEN&lt;BR /&gt;UPDATE SET ElectricModel.dbo.Transformer_evw.esElementName= WMMExport.dbo.TRANSFORMER.wmElementName;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC dbo.edit_version 'WMMUpdate', 2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2018 15:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767234#M747</guid>
      <dc:creator>AdelaideZumwalt1</dc:creator>
      <dc:date>2018-01-24T15:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767235#M748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you check the Versioned View, if it was updated or not? I tested a similar scenario at my end and observed the error. However, the data did get updated.&lt;/P&gt;&lt;P&gt;This error is observed if I execute all the SQL together. Not if I execute 1 statement at a time...check that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/394746_Capture.PNG" style="width: 771px; height: 337px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jan 2018 06:13:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767235#M748</guid>
      <dc:creator>Asrujit_SenGupta</dc:creator>
      <dc:date>2018-01-25T06:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767236#M749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I checked the versioned view in ArcMap and there were 0 changes. The version doesn't even have a "Modified Date. I ran it as a query and got the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Msg 50000, Level 16, State 1, Procedure edit_version, Line 144&lt;BR /&gt;Cannot stop edit on WMMUpdate while version id 20 is the current edit version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is version id 20?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/394848_Capture.PNG" style="height: auto;" /&gt;"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jan 2018 15:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767236#M749</guid>
      <dc:creator>AdelaideZumwalt1</dc:creator>
      <dc:date>2018-01-25T15:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767237#M750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;If you query a versioned view without setting the version and state, you are referencing the current state of the &lt;STRONG&gt;DEFAULT&lt;/STRONG&gt; version.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.5/manage-data/using-sql-with-gdbs/what-is-a-versioned-view.htm" title="http://desktop.arcgis.com/en/arcmap/10.5/manage-data/using-sql-with-gdbs/what-is-a-versioned-view.htm"&gt;What is a versioned view?—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Connect to that version from ArcMap and check for the chenges.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;The version doesn't even have a "Modified Date.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is fine. If you run a Reconcile on that version or make any update using ArcMap, you will see that getting updated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Msg 50000, Level 16, State 1, Procedure edit_version, Line 144&lt;BR /&gt;Cannot stop edit on WMMUpdate while version id 20 is the current edit version.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is happening, because &lt;STRONG&gt;another version&lt;/STRONG&gt; is set as the &lt;STRONG&gt;current edit version&lt;/STRONG&gt; &amp;amp; you are trying to stop editing on WMMUpdate version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;What is version id 20?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Check the&amp;nbsp;&lt;STRONG&gt;SDE_versions&lt;/STRONG&gt; table from the database end..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/395117_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jan 2018 09:42:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767237#M750</guid>
      <dc:creator>Asrujit_SenGupta</dc:creator>
      <dc:date>2018-01-28T09:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767238#M751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I got the scheduled job to run correctly once I created the version&amp;nbsp;and just had sql update it. Although the data was updated correctly, the errors included:&lt;/P&gt;&lt;P&gt;"Not currently editing a version&amp;lt;c/&amp;gt; cannot stop edit. [SQLSTATE 42000] (Error 50000).&amp;nbsp; The step failed."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice to get the job to run without these errors so the job history isn't filled with red x's. Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC dbo.set_current_version 'WMMUpdate';&lt;BR /&gt;EXEC dbo.edit_version 'WMMUpdate', 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MERGE ElectricModel.dbo.Transformer_evw&lt;BR /&gt;USING WMMExport.dbo.TRANSFORMER&lt;BR /&gt;ON ElectricModel.dbo.Transformer_evw.GUID_WMM = WMMExport.dbo.TRANSFORMER.wm_ElementGuid&lt;BR /&gt;WHEN MATCHED THEN&lt;BR /&gt;UPDATE SET ElectricModel.dbo.Transformer_evw.esElementName= WMMExport.dbo.TRANSFORMER.wmElementName;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;EXEC dbo.edit_version 'WMMUpdate', 2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Feb 2018 15:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767238#M751</guid>
      <dc:creator>AdelaideZumwalt1</dc:creator>
      <dc:date>2018-02-22T15:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767239#M752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have the same issue with&amp;nbsp;&lt;SPAN style="font-size: 11.0pt;"&gt;“Not currently editing a version, cannot stop edit.”&amp;nbsp;&lt;/SPAN&gt; after migrating our geodatabase from 10.3 to 10.5 within a SQL Server 2016 database. As an additional issue, EXEC sde.edit_version 'version2edit',1 does not set the editable version as the currect version, so we end up editing the wrong version. We think it has something to do with CONTEXT_INFO which does not return the new values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Were you ever able to solve this problem? Your experience would be most welcome.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2020 14:05:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767239#M752</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-17T14:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767240#M753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To set the current version use:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;EXEC&lt;/SPAN&gt; sde&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;set_current_version &lt;SPAN class="string token"&gt;'myedits12111'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;EXEC&lt;/SPAN&gt; sde&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;version_util&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;set_current_version&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'USER.ABC'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;EXEC&lt;/SPAN&gt; sde&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;version_user_ddl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;edit_version&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'USER.ABC'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;DELETE&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;USER&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ABCD_EVW &lt;SPAN class="keyword token"&gt;WHERE&lt;/SPAN&gt; XXXX &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'12345'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;COMMIT&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;EXEC&lt;/SPAN&gt; sde&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;version_user_ddl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;edit_version&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'USER.ABC'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.7/manage-data/using-sql-with-gdbs/edit-versioned-data-using-sql-sqlserver.htm" title="https://desktop.arcgis.com/en/arcmap/10.7/manage-data/using-sql-with-gdbs/edit-versioned-data-using-sql-sqlserver.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Edit versioned data in SQL Server using SQL—Help | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:32:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767240#M753</guid>
      <dc:creator>Asrujit_SenGupta</dc:creator>
      <dc:date>2021-12-12T08:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Error: "Not currently editing a version, cannot stop edit."</title>
      <link>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767241#M754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These are indeed the SDE-commands we use. However, after migrating the geodatabase from 10.3 to 10.5, EXEC sde.edit_version '&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #3d3d3d; font-family: inherit; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;version2edit',1 does not set the editable version as the currect version. SDE stored procedures SDE_get_globals and SDE_set_globals use the CONTEXT_INFO value, to set the right environment within the script (in which we do the editing). For some reason, CONTEXT_INFO is no longer refreshed immediately, with severe consequences for the integrity of the database. Only, when we run the commands (open edit version, do edits, close edit version) in separate batches, then the CONTEXT_INFO value is passed correctly. I hope this clarified our problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2020 08:57:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/sql-error-quot-not-currently-editing-a-version/m-p/767241#M754</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-03-20T08:57:50Z</dc:date>
    </item>
  </channel>
</rss>

