开发者

Problem with DATE type in SQL Server

I'm trying to CREATE a TABLE with an attribute of type DATE in Microsoft SQL Server 2008. However, when I execute the query,

I get t开发者_JAVA技巧he error:

Column, parameter, or variable #3: Cannot find data type DATE.

I consulted the documentation, and it indicated that DATE is a valid type in SQL Server. It works if I replace "DATE" with "DATETIME". My guess is I'm missing something really simple, but I just started learning SQL and SQL Server; does anybody have an idea?


If you really want to use DATE, you could change the compatibility level of the database.

ALTER DATABASE dbname SET COMPATIBILITY_LEVEL = 100

That would switch the database to 2008 compatibility, and you should be able to use the DATE datatype.

See http://msdn.microsoft.com/en-us/library/bb510680.aspx


It is possible that your database is 8.0 or 9.0 compatible. In this case you cannot use DATE type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜