了解 SQL Server 中的 COMPATIBILITY_LEVEL

Understanding COMPATIBILITY_LEVEL in SQL Server(了解 SQL Server 中的 COMPATIBILITY_LEVEL)
本文介绍了了解 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)