Linq.Skip and ‘The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.’

I used the following query to limit data read from a database log:

logViewModel.LogEntries = db.LogEntries.Skip(count-1000).OrderByDescending(x => x.EventTime).ToList();

And I got the error as in the title.

It seems that Linq.Skip is not supported with tables that have a ntext, text or image field.

Stupid me, why did I set up the table with ntext, as I understand it’s going to be removed from the future Sql Server versions anyway.

You can try to go around the problem by converting the Text fields to nvarchar(1234) or similar, but for me the easier way was to drop the table and add it with a nvarchar(1000) field instead.



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s