了解SQL Server中的COMPATIBILITY_LEVEL [英] Understanding COMPATIBILITY_LEVEL in SQL Server
问题描述
我了解,将数据库设置为COMPATIBILITY_LEVEL之前,您的本机一个阻止使用功能。但是似乎不是这样的。请看以下SQL脚本:
I understood that setting a database to a COMPATIBILITY_LEVEL prior to your native one prevented features from being used. However this doesn't seem to be the case. Witness the following SQL script:
CREATE DATABASE Foo
GO
USE Foo
GO
ALTER DATABASE Foo SET COMPATIBILITY_LEVEL = 80
GO
CREATE TABLE Bar
(
Id UNIQUEIDENTIFIER NOT NULL,
TestNvcMax NVARCHAR (MAX) NOT NULL, -- Arrived in SQL 2005
TestDateTime2 DATETIME2 (7) NOT NULL -- Arrived in SQL 2008
)
GO
但是这个表创建完美 - 任何想法?
But this table creates perfectly - any ideas? I would have thought some kind of an error message or warning would have been appropriate
推荐答案
在这里,您可以了解兼容性之间的差异级别80,90和100. ALTER DATABASE兼容性级别
Here you can read about the differences between compatibility level 80, 90 and 100. ALTER DATABASE Compatibility Level
显然,新的数据类型不受影响。我认为兼容性级别是有使SQL Server行为像旧版本,不阻止你做新的花哨的东西。
Apparently new data types is not affected. I think that compatibility level is there to make SQL Server "behave" like the older version, not prevent you from doing new fancy stuff.
这篇关于了解SQL Server中的COMPATIBILITY_LEVEL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!