{"id":17380,"date":"2022-08-10T07:00:00","date_gmt":"2022-08-10T05:00:00","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=17380"},"modified":"2025-10-01T12:03:57","modified_gmt":"2025-10-01T10:03:57","slug":"sql-server-deadlock-on-update-with-serializable-isolation-level","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/","title":{"rendered":"SQL Server Deadlock on UPDATE with Serializable isolation level"},"content":{"rendered":"\n<p>Recently I spent some time on a recurring Deadlock problem on a customer&#8217;s site in a high concurrency environment. It was only after finding the solution on my own that I discovered that this particular problem is already well documented if you search for the right keyword. \u00af\\_(\u30c4)_\/\u00af<\/p>\n\n\n\n<p>Anyway, in this blog, I will give feedback with some useful information about this specific Deadlock case.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-the-deadlock\">The Deadlock<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-deadlock-graph\">Deadlock Graph<\/h4>\n\n\n\n<p>Here is a Deadlock graph similar to the real one the customer had in Production :<\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"442\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_Graph.jpg\" alt=\"Deadlock Graph\" class=\"wp-image-17388\" style=\"width:884px;height:497px\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_Graph.jpg 786w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_Graph-300x169.jpg 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_Graph-768x432.jpg 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n<\/div>\n\n\n<p>Looking at the XML properties we can notice the isolation level of both transactions is Serializable and that it&#8217;s the same object (stored procedure) causing the deadlock.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-stored-procedure\">Stored Procedure<\/h4>\n\n\n\n<p>Here is what the stored procedure looks like.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE PROCEDURE dbo.&#091;bigTransactionHistory]\n\t@TransactionID\t\tbigint\n\t, @ProductID\t\tint\n\t, @TransactionDate\tdatetime\n\t, @Quantity\t\t\tint\n\t, @ActualCost\t\tmoney\nAS\nBEGIN\n\tSET NOCOUNT ON;\n\n\tSET TRANSACTION ISOLATION LEVEL SERIALIZABLE\n\n\tBEGIN TRAN\n\t\tIF EXISTS(SELECT 1 FROM &#091;bigTransactionHistory] WHERE TransactionID = @TransactionID)\n\t\tBEGIN\n\t\t\tUPDATE dbo.&#091;bigTransactionHistory]\n\t\t\tSET ProductID = @ProductID\n\t\t\t\t, TransactionDate =\t@TransactionDate\n\t\t\t\t, Quantity =\t\t@Quantity\n\t\t\t\t, ActualCost =\t\t@ActualCost\n\t\t\tWHERE TransactionID = @TransactionID\n\t\tEND\n\t\tELSE\n\t\tBEGIN\n\t\t\tINSERT INTO &#091;bigTransactionHistory](\n\t\t\t\t&#091;TransactionID]\n\t\t\t\t, &#091;ProductID]\n\t\t\t\t, &#091;TransactionDate]\n\t\t\t\t, &#091;Quantity]\n\t\t\t\t, &#091;ActualCost])\n\t\t\tVALUES (\n\t\t\t\t@TransactionID\n\t\t\t\t, @ProductID\n\t\t\t\t, @TransactionDate\n\t\t\t\t, @Quantity\n\t\t\t\t, @ActualCost\n\t\t\t)\n\t\tEND\n\tCOMMIT\nEND<\/code><\/pre>\n\n\n\n<p>The stored procedure is doing an UPDATE or an INSERT based on the existence of the row inside the table.<br>The existence check is performed with the &#8220;IF EXISTS(SELECT&#8230;)&#8221;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-serializable-isolation-level\">Serializable isolation level<\/h3>\n\n\n\n<p>The <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/statements\/set-transaction-isolation-level-transact-sql?view=sql-server-ver16\">documentation<\/a> mentions the following behavior for this level of isolation:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>No other transactions can modify <strong>data that has been read<\/strong> by the current transaction until the current transaction completes.<\/em><\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>Other transactions cannot insert new rows with key values that would <strong>fall in the range of keys read <\/strong>by any statements in the current transaction until the current transaction completes.<\/em><\/p>\n<\/blockquote>\n\n\n\n<p>It&#8217;s the &#8220;IF EXISTS&#8221; which reads the row and holds a RangeS-S lock for the duration of the transaction.<br>If the Stored Procedure is run at the same time for the same key in two concurrent sessions the deadlock can occur.<\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"337\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-14-1024x337.png\" alt=\"StoredProcedureAndLocks\" class=\"wp-image-17393\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-14-1024x337.png 1024w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-14-300x99.png 300w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-14-768x253.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-14.png 1114w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>RangeS-S and RangeX-X are <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/sql-server-transaction-locking-and-row-versioning-guide?view=sql-server-ver16#key-range-locking\">incompatible locks<\/a>.<\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"630\" height=\"360\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-15.png\" alt=\"Range Locks compatibility matrix\" class=\"wp-image-17394\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-15.png 630w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/image-15-300x171.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-solution\">Solution<\/h3>\n\n\n\n<p>To solve this deadlock I changed the Stored Procedure removing the IF EXISTS(SELECT..). <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tSET TRANSACTION ISOLATION LEVEL SERIALIZABLE\n\n\tBEGIN TRAN\n\t\t\tUPDATE dbo.&#091;bigTransactionHistory]\n\t\t\tSET ProductID = @ProductID\n\t\t\t\t, TransactionDate =\t@TransactionDate\n\t\t\t\t, Quantity =\t\t@Quantity\n\t\t\t\t, ActualCost =\t\t@ActualCost\n\t\t\tWHERE TransactionID = @TransactionID\n\t\tIF @@ROWCOUNT = 0\n\t\tBEGIN\n\t\t\tINSERT INTO &#091;bigTransactionHistory](\n\t\t\t\t&#091;TransactionID]\n\t\t\t\t, &#091;ProductID]\n\t\t\t\t, &#091;TransactionDate]\n\t\t\t\t, &#091;Quantity]\n\t\t\t\t, &#091;ActualCost])\n\t\t\tVALUES (\n\t\t\t\t@TransactionID\n\t\t\t\t, @ProductID\n\t\t\t\t, @TransactionDate\n\t\t\t\t, @Quantity\n\t\t\t\t, @ActualCost\n\t\t\t)\n\t\tEND\n\tCOMMIT<\/code><\/pre>\n\n\n\n<p>The UPDATE is performed at all times. If no row is updated (checked with @@ROWCOUNT) a new row is INSERTED, removing the need for a first RangeS-S lock and any Deadlock possibility.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-upsert\">UPSERT<\/h3>\n\n\n\n<p>This type of scenario is a classic and is called UPSERT.<br>You can find a great article about this from Michael J. Swart; <a href=\"https:\/\/michaeljswart.com\/2017\/07\/sql-server-upsert-patterns-and-antipatterns\/\">SQL Server UPSERT Patterns and Antipatterns<\/a><\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"300\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/upsert.png\" alt=\"\" class=\"wp-image-17381\" style=\"width:500px;height:300px\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/upsert.png 500w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/upsert-300x180.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><figcaption class=\"wp-element-caption\">UPSERT scenario, from Michael J. Swart<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Interesting fact, some SQL Database Management Systems like CockroachDB implement an <a href=\"https:\/\/www.cockroachlabs.com\/docs\/stable\/upsert.html\">UPSERT<\/a> statement.<\/p>\n\n\n\n<p>This UPSERT article adds a UPDLOCK hint to the UPDATE statement.<br>The idea is to protect against a potential conversion deadlock. I have not encountered this type of deadlock but the addition of UPLOCK is a good thing to prevent any deadlock (and the associated retry logic). It will force other transactions to wait for the requested U lock.<br>The hint should be added to the UPDATE statement like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE dbo.&#091;bigTransactionHistory] WITH (UPDLOCK)\nSET ProductID = @ProductID\n\t, TransactionDate =\t@TransactionDate\n\t, Quantity =\t\t@Quantity\n\t, ActualCost =\t\t@ActualCost\nWHERE TransactionID = @TransactionID<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h3>\n\n\n\n<p>The UPSERT pattern is very common but is not trivial to write correctly in SQL. I hope this can help you understand and solve this kind of Deadlocks.<\/p>\n\n\n\n<p>Written by <a href=\"https:\/\/www.linkedin.com\/in\/steven-naudet-aa540158\/\">Steven Naudet<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I spent some time on a recurring Deadlock problem on a customer&#8217;s site in a high concurrency environment. It was only after finding the solution on my own that I discovered that this particular problem is already well documented if you search for the right keyword. \u00af\\_(\u30c4)_\/\u00af Anyway, in this blog, I will give [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":18402,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,99],"tags":[2571,2572,2550,2660],"type_dbi":[],"class_list":["post-17380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","category-sql-server","tag-deadlock","tag-serializable","tag-sql-server-2","tag-upsert"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server Deadlock on UPDATE with Serializable isolation level - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server Deadlock on UPDATE with Serializable isolation level\" \/>\n<meta property=\"og:description\" content=\"Recently I spent some time on a recurring Deadlock problem on a customer&#8217;s site in a high concurrency environment. It was only after finding the solution on my own that I discovered that this particular problem is already well documented if you search for the right keyword. \u00af_(\u30c4)_\/\u00af Anyway, in this blog, I will give [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-10T05:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-01T10:03:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1114\" \/>\n\t<meta property=\"og:image:height\" content=\"367\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"SQL Server Deadlock on UPDATE with Serializable isolation level\",\"datePublished\":\"2022-08-10T05:00:00+00:00\",\"dateModified\":\"2025-10-01T10:03:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\"},\"wordCount\":471,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg\",\"keywords\":[\"Deadlock\",\"Serializable\",\"SQL Server\",\"UPSERT\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\",\"name\":\"SQL Server Deadlock on UPDATE with Serializable isolation level - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg\",\"datePublished\":\"2022-08-10T05:00:00+00:00\",\"dateModified\":\"2025-10-01T10:03:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg\",\"width\":1114,\"height\":367,\"caption\":\"StoredProcedureAndLocks\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server Deadlock on UPDATE with Serializable isolation level\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server Deadlock on UPDATE with Serializable isolation level - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server Deadlock on UPDATE with Serializable isolation level","og_description":"Recently I spent some time on a recurring Deadlock problem on a customer&#8217;s site in a high concurrency environment. It was only after finding the solution on my own that I discovered that this particular problem is already well documented if you search for the right keyword. \u00af_(\u30c4)_\/\u00af Anyway, in this blog, I will give [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/","og_site_name":"dbi Blog","article_published_time":"2022-08-10T05:00:00+00:00","article_modified_time":"2025-10-01T10:03:57+00:00","og_image":[{"width":1114,"height":367,"url":"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg","type":"image\/jpeg"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"SQL Server Deadlock on UPDATE with Serializable isolation level","datePublished":"2022-08-10T05:00:00+00:00","dateModified":"2025-10-01T10:03:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/"},"wordCount":471,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg","keywords":["Deadlock","Serializable","SQL Server","UPSERT"],"articleSection":["Database Administration &amp; Monitoring","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/","name":"SQL Server Deadlock on UPDATE with Serializable isolation level - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg","datePublished":"2022-08-10T05:00:00+00:00","dateModified":"2025-10-01T10:03:57+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/06\/Deadlock_SSMS.jpg","width":1114,"height":367,"caption":"StoredProcedureAndLocks"},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-deadlock-on-update-with-serializable-isolation-level\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server Deadlock on UPDATE with Serializable isolation level"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=17380"}],"version-history":[{"count":22,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17380\/revisions"}],"predecessor-version":[{"id":40622,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17380\/revisions\/40622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/18402"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17380"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=17380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}