问题描述
我知道在您的原生数据库之前将数据库设置为 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 之间的差异.更改数据库兼容级别
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!