问题
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.
So I tried setting the compatibility of the database to 100 using the following:
ALTER DATABASE znode_multifront SET COMPATIBILITY = 100
I receive the following error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '100'.
So I tried going into SQLCMD mode and used the following:
EXEC sp_dbcmptlevel znode_multifront, 100;
Which produced the following error:
Msg 15416, Level 16, State 1, Procedure sp_dbcmptlevel, Line 70
Usage: sp_dbcmptlevel [dbname [, compatibilitylevel]]
I am very new to SQL Server. Any help would be greatly appreciated.
回答1:
alter database znode_multifront
set compatibility_level = 100
go
You were close. The set option is COMPATIBILITY_LEVEL, not COMPATIBILITY like you have in your original post.
You will need ALTER permission on the database to execute the above query.
来源:https://stackoverflow.com/questions/8744455/sql-server-cannot-find-data-type-date-and-unable-to-set-compatibility