I've hit an error when I've been working on a table that uses a text field.
If I was getting the length of a varchar column I could do
var result = (from t in context.tablename select t.fullname.Length)
However, if I run the same query on a text field:
var result = (from t in context.tablename select t.biography.Length)
I get the error :
Argument data type text is invalid for argument 1 of len function
.
Having done a bit of reading up on the subject I understand why SQL Server raises this error but I'm not sure of the best way around it. I know I could return the result and then get the length of the resulting string but surely there is an easier way of doing this?