{"id":28,"date":"2009-01-06T11:25:00","date_gmt":"2009-01-06T11:25:00","guid":{"rendered":"http:\/\/localhost:10265\/?p=27"},"modified":"2009-01-06T11:25:00","modified_gmt":"2009-01-06T11:25:00","slug":"sql-server-savepoints","status":"publish","type":"post","link":"https:\/\/mehdi.biz\/blog\/2009\/01\/06\/sql-server-savepoints\/","title":{"rendered":"SQL Server Savepoints"},"content":{"rendered":"<!-- google_ad_section_start --><p>There are some conditions when you need to rollback an implicit or explicit transaction to a given point inside the transaction. There are two ways to address such a need:<\/p>\n<p>1. You can use the <b>T-SQL<\/b> to address such a problem:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\nSAVE TRAN savePointName\n--Modify the data source\nROLLBACK TRAN savePointName\n<\/pre>\n<p>2. Use the <b>SqlTransaction&#8217;s Save<\/b> method within your code. Please note that this method is not part of the standard IDbTransaction interface and is located specifically on the SqlTransaction class:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/Mark a savepoint.\ntran.Save(&quot;savePointName&quot;);\n\/\/Modify the data source\ntran.Rollback(&quot;savePointName&quot;);\n<\/pre>\n<p>Please also note that when you rollback a transaction to a savepoint, resources are continued to be held until either the completion of the transaction or a rollback of the complete transaction. Therefore a commit or a complete rollback should always follow a rollback to savepoint.<\/p>\n<!-- google_ad_section_end -->","protected":false},"excerpt":{"rendered":"<p>There are some conditions when you need to rollback an implicit or explicit transaction to a given point inside the transaction. There are two ways to address such a need:<\/p>\n<p>1. You can use the T-SQL to address such a problem:<\/p>\n<p> SAVE TRAN savePointName &#8211;Modify the data source ROLLBACK TRAN savePointName <\/p>\n<p>2. Use the SqlTransaction&#8217;s [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4,7],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-csharp","category-sql"],"_links":{"self":[{"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":0,"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mehdi.biz\/blog\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}