Reputation: 4024
I've developed my website using EF4 and SQL Server 2005, but when moving to the staging site it turns out that they use SQL Server 2000.
Now I'm getting this error, which I believe is related to SQL Server 2000:
Incorrect syntax near '('. 'row_number' is not a recognized function name.
Is there a way of fixing this?
Thanks
Upvotes: 2
Views: 846
Reputation: 1122
I came across the exact same problem and as per the comments/responses on StackOverflow I had almost given up and flicked it to client to upgrade their database to > 2000 version. Unfortunately that wasn't possible for them due to many other issues. I had to go around googling for a solution and from somewhere I found a work-around.
This is what I did.
Now the reason I'm saying it's a work-around (not a solution) is because
If you update your model from database again and your development machine database is >= 2000 (which is likely to be a case as SQL 2000 connection is not supported at all by MS according to this article) this value in the XML will change automatically
Also, the queries generated by EF after this change have worked in my situation but I cannot guarantee that all the queries ever generated by your application would work without any problems
Upvotes: 1
Reputation: 13367
Row_Number() returns the sequential number for a each row returned. Are you calling Row_number(), or is the entity framework?
Either way, you may be able to write a user-defined function that re-implements ROW_NUMBER. Stackoverflow post on this here: ROW_NUMBER Alternative for SQL Server 2000
Not sure this is going to do any good in the long run; you're likely to find that you get around this problem only to encounter the next reason that EF doesn't work on SQL 2000. But, it might be worth the few minutes to try.
Upvotes: 0