
{"id":8143,"date":"2019-06-19T15:24:45","date_gmt":"2019-06-19T15:24:45","guid":{"rendered":"https:\/\/rax-stg-wp-aws.com\/blogs\/microsoft-sql-server-database-compatibility-levels\/"},"modified":"2026-11-03T19:29:27","modified_gmt":"2026-11-03T19:29:27","slug":"microsoft-sql-server-database-compatibility-levels","status":"publish","type":"blogs","link":"https:\/\/www.rackspace.com\/de\/blogs\/microsoft-sql-server-database-compatibility-levels\/","title":{"rendered":"Microsoft SQL Server database compatibility levels"},"content":{"rendered":"<p><strong>Introduction<\/strong><\/p>\n<p>Database compatibility level, one of the database level settings, impacts how a&nbsp;database functions. Each new version of Microsoft\u00a9 , SQL Server\u00a9 introduces&nbsp;many new features, most of which require new keywords and change certain&nbsp;behaviors that existed in earlier versions. To provide maximum backward&nbsp;compatibility, Microsoft enables us to set the compatibility level according to<br \/>\nour needs.<\/p>\n<p>By default, every database inherits the compatibility level of the model&nbsp;database version from which it was created. For example, the compatibility&nbsp;level of a SQL Server 2012 database defaults to 110 unless you change it.<\/p>\n<p><strong>Compatibility levels after a restore<\/strong><\/p>\n<p>When you restore a database backup taken on an older version of SQL, the&nbsp;database compatibility level remains the same as it was on the instance from&nbsp;which you took the backup, unless the source compatibility level is lower than&nbsp;the minimum supported level. In that case, the database compatibility level&nbsp;changes to the lowest supported version. For example, if we restore a SQL Server&nbsp;2005 database backup to SQL Server 2017, then the compatibility level of the restored&nbsp;database would be set to 100 because that is the minimum SQL 2017 level&nbsp;supported.<\/p>\n<p><strong>Compatibility levels after an upgrade<\/strong><\/p>\n<p>The compatibility levels of the tempdb, model, msdb, and resource databases are&nbsp;set to the current compatibility level after an upgrade. The master system&nbsp;database retains the compatibility level it had before the upgrade.<strong>&nbsp;Determine the compatibility level<\/strong><\/p>\n<p>To determine the current compatibility level, query the <strong>compatibility_level&nbsp;<\/strong>column of <strong>sys.databases<\/strong>.<\/p>\n<p>To change to a different compatibility level, use the `<em>ALTER DATABASE<\/em>` command as&nbsp;shown in the following example:<\/p>\n<p><em>&nbsp; &nbsp; Use Master<br \/>\n&nbsp; &nbsp; Go<br \/>\n&nbsp; &nbsp; ALTER DATABASE &lt;database name&gt;SET COMPATIBILITY_LEVEL = &lt;compatibility-level&gt;;<\/em><\/p>\n<p>If you prefer, you can use the wizard to change the compatibility level. However,&nbsp;if the database is accessed online by users, you should change the database to&nbsp;single-user mode first. &nbsp;Then, after you use the wizard to change the level, you&nbsp;should put the database in multi-user mode.<\/p>\n<p>To change compatibility level with the wizard, right-click <strong>database \u2013&gt; property<br \/>\n\u2013&gt; options \u2013&gt; Database compatibility level<\/strong>&nbsp;as shown in the following image:<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26608-body-Picture1_14.png\" alt=\"mssql compatibility pic 1\" \/><\/p>\n<p><strong>Default and supported compatibility levels<\/strong><\/p>\n<p>The following table shows SQL Server versions with their default compatibility&nbsp;and a list of supported compatibility levels:<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26608-body-Picture2_12.png\" alt=\"mssql compatibility pic 2\" \/><\/p>\n<p><a href=\"https:\/\/www.sqlskills.com\/blogs\/glenn\/database-compatibility-level-in-sql-server\/\"><em>Image Source<\/em><\/a>&nbsp;<\/p>\n<p><strong>Database compatibility level and performance<\/strong><\/p>\n<p>In versions of SQL Server earlier than SQL 2014, database administrators never&nbsp;worried about database compatibility level from a performance perspective.&nbsp;Database compatibility level was mainly used as a mechanism to control whether&nbsp;new features introduced in that version could be used or whether non-supported&nbsp;features were disabled. It was also used to control backward compatibility.<\/p>\n<p>Now, when you migrate from one version to another, you should do a full&nbsp;regression test to understand the change in&nbsp; performance. Sometimes, a query&nbsp;performs better with the old compatibility level even after migration. However,&nbsp;in other cases, it could be the opposite, so make sure to do a full regression&nbsp;testing.<\/p>\n<p>Since SQL Server 2014, any database running at compatibility level 120 or above&nbsp;can make use of the new <em>cardinality estimate<\/em>&nbsp;function. Cardinality estimation&nbsp;is the logic that takes place to determine how SQL Server executes a query,<br \/>\nbased on its estimated cost. The estimation is calculated by using input from&nbsp;statistics associated with objects involved in that query. Practically, at a&nbsp;high-level, cardinality estimates are row-count estimates combined with&nbsp;information about the distribution of the values, distinct value counts, and&nbsp;duplicate counts contained in the tables and objects referenced in the query.&nbsp;Getting these estimates wrong can lead to unnecessary disk I\/O due to&nbsp;insufficient memory grants (such as TempDB spills) or to the selection of a&nbsp;serial plan execution over a parallel plan execution, to name a few possibilities.&nbsp;<\/p>\n<p>\n<strong>Impact of changing the compatibility level<\/strong><\/p>\n<p>Changing the compatibility level tells the database to change its feature set.&nbsp;That is, some features are added, and at the same time, some old features are&nbsp;removed. For example, the <em>FOR BROWSE<\/em>&nbsp;clause is not allowed in <em>INSERT<\/em>&nbsp;and <em>SELECT<br \/>\nINTO<\/em>&nbsp;statements at compatibility level 100, and it is allowed but ignored at&nbsp;compatibility level 90. If your application uses this feature, this change might&nbsp;introduce unexpected results.<\/p>\n<p>When you move a database from a lower to a higher compatibility level, you might&nbsp;expect that you are not able to use the new feature if compatibility is not&nbsp;changed. However, that is not entirely correct. This is only true for the database&nbsp;level feature. You can use instance level features even if you don\u2019t change the&nbsp;compatibility level.<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>Database compatibility level defines how SQL Server uses certain features.&nbsp;Specifically, it causes them to act like a given version of SQL Server, which is&nbsp;typically done to provide some level of backward compatibility. Because this is&nbsp;a database property, the compatibility affects only database level features for&nbsp;that specific database.<\/p>\n<p>If you upgrade a database by either moving it to a server with a higher version&nbsp;or by doing an instance upgrade in place, the compatibility level remains the&nbsp;same as long as that level is supported.<\/p>\n<p>If the compatibility level is set to SQL 2014 or higher, SQL Server uses the new&nbsp;cardinality estimation feature. If the compatibility level is set to 2012 or&nbsp;lower, the old optimizer is used.<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft SQL Server database compatibility levels<\/p>\n","protected":false},"author":2,"featured_media":8145,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":{"content-type":"","nid":"26608","content_type":"blog","created_by":"10130","authored_on":"2024-02-13T16:24:45+00:00","field_article_industries":"","tag_category":"Technical","field_blog_author_text":"by Rackspace Technology Staff","seo_description":"Grasp the concept of database compatibility levels in Microsoft SQL Server. Learn how it impacts database functions and supports backward compatibility.\r\n","field_featured_image":"","insights_image":"\/wp-content\/uploads\/2026\/blog_technical_images\/26608-insights_image-microsoft-technical-blog-1-insights.jpg","field_partners":"","rxt_platforms":"Applications, Microsoft SQL","product":"","publisheddate":"2019-06-19T15:24:45","rxt_solutions":"Cloud Adoption & Migration","opengraph_tag":"","x_tag":"","teaser_flag":"Technical Blog","seo_titile":"Microsoft SQL Server Database Compatibility Levels | Rackspace Technology","field_topics":"","field_slug":"microsoft-sql-server-database-compatibility-levels","footnotes":""},"categories":[178],"tags":[204],"class_list":["post-8143","blogs","type-blogs","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-technical"],"_links":{"self":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/8143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs"}],"about":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/types\/blogs"}],"author":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/comments?post=8143"}],"version-history":[{"count":3,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/8143\/revisions"}],"predecessor-version":[{"id":9912,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/8143\/revisions\/9912"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/media\/8145"}],"wp:attachment":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/media?parent=8143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/categories?post=8143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/tags?post=8143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}