Geeks With Blogs
Codekiwi Just a the musings of a kiwi who loves to code...

Had a strange error come up today when I tried to use my home PC to run an Entity Framework project, the EDMX schema (is it a schema) was generated in SQL Server 2008 and my home dev machine has SQL Server 2005.

I wouldn't have thought this would be a problem as I don't use any 2008 specific features (except the intellisense ;P), but alas I was getting a lot of exceptions from my FunctionImports (stored proceedures in Entity Framework).

Upon investigating the stack trace it was telling me that the DateTime2 datatype was not supported in this version of SQL server, Very strange as I am sure that I do not use the Datetime2 or Date datatypes (these are 2008 specific)
 

This is due to the edmx file being generated or updated from a SQL 2008 instance and run against a SQL 2005 instance. I tried about every trick I could think of before reading about it here. Basically all you need to do is to open the EDMX file with XML Editor and change ProviderManifestToken=”2008” to ProviderManifestToken=”2005”. Thanks a bunch Alex Duggleby for the hint!

From The #Crypt Via Alex Duggleby

Just another thing that I hope will be fixed in the forthcoming EF4.

Posted on Tuesday, February 2, 2010 5:40 PM Entity Framework , SQL Server | Back to top


Comments on this post: This version of SQL Server in use does not support datatype datetime2 EF problem.

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Thank you so much, solved the issue, i will post the same in my blog.
Left by Senthamil on Jun 11, 2010 2:25 AM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
I'll second the "thank you".
And join you in hoping I don't have to resort to XML editing in future.
Left by Simon on Jan 24, 2011 6:50 PM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Thank you. You saved my butt, on last night deployment. :)
Left by var on Jan 28, 2011 3:27 AM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Would never found out without you. Thanks!
Left by cguillemette on Feb 04, 2011 9:16 PM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Thanks a lot bother .......
Left by aa on Feb 24, 2011 6:17 AM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Hum, this didn't work for me :(
I changed 2008 to 2005, rebuilt the app and still the same error.
EDMX file has more 2008 references inside. Should I change all to 2005?
Left by Adi on Jul 07, 2011 11:27 AM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Hey, sorry, I take it back. It was an issue related to updating the binaries.
Long story short, it worked! Thanks!
Left by Adi on Jul 07, 2011 12:03 PM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Thanks so much for this simple fix - you saved me a ton of time debugging why a program that worked in sql 2008 was bombing in 2005. Thanks for posting it! Regards -
Left by shawn on Sep 04, 2011 7:21 AM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
thanks, cross linking to stackoverflow to make it easier to find both links together. Google had this link at 6 vs stackoverflow at 1.

http://stackoverflow.com/questions/316422/using-sql-server-2008-and-sql-server-2005-and-date-time
Left by rusty on Sep 15, 2011 9:18 AM

# re: This version of SQL Server in use does not support datatype datetime2 EF problem.
Requesting Gravatar...
Thanks that is exactly what the fix I needed :)
Left by Mark vl on Mar 05, 2012 11:20 PM

Your comment:
 (will show your gravatar)
 


Copyright © Codekiwi | Powered by: GeeksWithBlogs.net | Join free