SQL Server:找不到数据类型日期并且无法设置兼容性 [英] SQL Server: Cannot find data type date and unable to set compatibility
问题描述
我有一个使用 DATE 的安装脚本.我正在运行 SQL Server 2008 R2,它不喜欢日期类型.
I have a install script that uses DATE. I'm running SQL Server 2008 R2, and it doesn't like the date type.
Msg 2715, Level 16, State 7, Line 1
Column, parameter, or variable #3: Cannot find data type date.
所以我尝试使用以下方法将数据库的兼容性设置为 100:
So I tried setting the compatibility of the database to 100 using the following:
ALTER DATABASE znode_multifront SET COMPATIBILITY = 100
我收到以下错误:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '100'.
所以我尝试进入 SQLCMD 模式并使用以下内容:
So I tried going into SQLCMD mode and used the following:
EXEC sp_dbcmptlevel znode_multifront, 100;
产生以下错误:
Msg 15416, Level 16, State 1, Procedure sp_dbcmptlevel, Line 70
Usage: sp_dbcmptlevel [dbname [, compatibilitylevel]]
我对 SQL Server 非常陌生.任何帮助将不胜感激.
I am very new to SQL Server. Any help would be greatly appreciated.
推荐答案
alter database znode_multifront
set compatibility_level = 100
go
你很接近.设置选项是 COMPATIBILITY_LEVEL
,而不是像您在原始帖子中那样的 COMPATIBILITY
.
You were close. The set option is COMPATIBILITY_LEVEL
, not COMPATIBILITY
like you have in your original post.
您需要对数据库具有 ALTER
权限才能执行上述查询.
You will need ALTER
permission on the database to execute the above query.
这篇关于SQL Server:找不到数据类型日期并且无法设置兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!