ERROR: The version of SQL Server in use does not support datatype 'datetime2'.

在刚接触的MVC2 Sample(NerdDinner)中,我把SQL2008的数据库转为SQL2005后

出现了

The version of SQL Server in use does not support datatype 'datetime2'.

其问题产生的原因是SQL2005没有该数据类型 datetime2

然后GOOGLE一翻找到答案

发生这个问题的主要原因是*.edmx中可以设置一个数据库版

<Schema Namespace="NerdDinnerModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">

改为

<Schema Namespace="NerdDinnerModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">

即可

原文地址:https://www.cnblogs.com/highend/p/1780569.html