EF4 and SQL Server 2000

I developed my site using EF4 and SQL Server 2005, but when I go to the intermediate site, it turns out that they use SQL Server 2000.

Now I get this error, which I think is related to SQL Server 2000:

Incorrect syntax near '('. 'row_number' is not a recognized function name. 

Is there any way to fix this?

thanks

+2
source share
3 answers

I ran into the same issue, and according to the comments / answers on StackOverflow, I almost gave up and clicked it on a client to upgrade my database to version 2000. Unfortunately, this was not possible for them due to many other problems. I needed to go on a search for a solution, and from somewhere I found a job.

This is what I did.

  • Right-click the ModelName.EDMX file -> Open with
  • Selected XML (text) editor
  • Found ProviderManifestToken = "2005" and replaced it with ProviderManifestToken = "2000"
  • Published changes and voila!

Now the reason I'm talking about this (not a solution) is because

  • If you upgrade your model from the database again and your development machine database = = 2000 (which will probably happen as SQL 2000 is not supported at all by MS according to this article ) this value in XML will automatically change.

  • In addition, the requests generated by EF after this change are my situation, but I can not guarantee that all requests ever created by your application will work without problems

+1
source

Row_Number () returns the sequence number for each row returned. Are you calling Row_number () or are you an entity framework?

In either case, you can write a custom function that reimplementes ROW_NUMBER. Stackoverflow post about it here: ROW_NUMBER Alternative for SQL Server 2000

Not sure if this will benefit in the long run; you will probably find that you are overcoming this problem only to meet the following reason why EF does not work on SQL 2000. But it might be worth a few minutes.

0
source

All Articles