Sonic Soul
Sonic Soul

Reputation: 24919

Entity Framework: Generated SQL - cannot find data type datetime2

So we migrated dev sql server to 2008.

Our UAT sql server is still 2005.

i had to regenerate my entity framework model for some other reasons, and upon deploying my work to UAT i noticed this error:

cannot find data type datetime2

I profiled the database, and noticed that Entity Framework generated the input parameter as datetime2!

N'@p__linq__0 datetime2(7)',@p__linq__0='9999-12-31 00:00:00'

this executes fine in dev, because datetime2 is a type there. but fails when deployed to environment with 2005.

Is this some sort of known type? Why is entity framework not using regular datetime, and how can i make it cross environment compatible?

perhaps this is not 2008 upgrade related.. but it wasn't an issue before the upgrade and this code has not changed.

Upvotes: 1

Views: 2862

Answers (1)

Will A
Will A

Reputation: 24988

Take a look at this 'bug' on MS Connect - the workarounds seem to supply a fairly straightforward fix.

Also covered here.

Upvotes: 3

Related Questions