Understanding COMPATIBILITY_LEVEL in SQL Server(了解 SQL Server 中的 COMPATIBILITY_LEVEL)
问题描述
我知道在您的原生数据库之前将数据库设置为 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:了解 SQL Server 中的 COMPATIBILITY_LEVEL


- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- SQL 临时表问题 2022-01-01