¿Cómo verificar la compatibilidad de la base de datos de SQL Server después de que sp dbcmptlevel esté obsoleto?
De acuerdo con BOL (SQL Server Books Online) en sp_dbcmptlevel
,
Esta característica se eliminará en una versión futura de Microsoft SQL Server. No utilice esta función en nuevos trabajos de desarrollo y modifique las aplicaciones que actualmente la utilizan lo antes posible. En su lugar, utilice MODIFICAR el nivel de compatibilidad de la BASE de DATOS.
Ahora, la única forma de TSQL que conozco de comprobar la compatibilidad de la base de datos es a través de sp_dbcmptlevel
.
Que yo sepa, ALTER DATABASE Compatibility Level
es sólo para establecer el nivel de compatibilidad, no obtener información.
¿Cómo se debe obtener el nivel de compatibilidad sin usar GUI?
6 answers
select name, compatibility_level , version_name =
CASE compatibility_level
WHEN 65 THEN 'SQL Server 6.5'
WHEN 70 THEN 'SQL Server 7.0'
WHEN 80 THEN 'SQL Server 2000'
WHEN 90 THEN 'SQL Server 2005'
WHEN 100 THEN 'SQL Server 2008/R2'
WHEN 110 THEN 'SQL Server 2012'
WHEN 120 THEN 'SQL Server 2014'
WHEN 130 THEN 'SQL Server 2016'
WHEN 140 THEN 'SQL Server 2017'
ELSE 'new unknown - '+CONVERT(varchar(10),compatibility_level)
END
from sys.databases
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-22 18:04:20
select compatibility_level from sys.databases where name ='myDB'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-10-01 02:42:06
Pensé que esto sería útil aquí...
65 = SQL Server 6.5
70 = SQL Server 7.0
80 = SQL Server 2000
90 = SQL Server 2005
100 = SQL Server 2008/R2
110 = SQL Server 2012
120 = SQL Server 2014
130 = SQL Server 2016
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-27 20:11:38
Me gustaría añadir la respuesta de msdn:
USE AdventureWorks2012;
GO
SELECT compatibility_level
FROM sys.databases WHERE name = 'AdventureWorks2012';
GO
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-23 06:31:12
Change para cambiarlo
EXEC sp_dbcmptlevel 'db_name', 130
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-20 10:47:58
Cómo comprobar la compatibilidad de la base de datos de SQL Server
SELECT compatibility_level as [Current compatibility_level] FROM sys.databases WHERE name = 'Database Name';
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-06-07 09:26:33