We have a database with some fields that are varchar (max) that can contain a lot of text, however I have a situation where I want to select only the first 300 characters from a field for a broken table of results on the MVC website for "preliminary view 'fields.
for a simplified query example where I want all locations to appear in a table (this would be paginated, so I don't just get everything - I get maybe 10 results at a time):
return db.locations;
However, this gives me a location object with all the fields containing huge amounts of text, which are very laborious to execute.
So, to what I turned to earlier, SQL stored procedures were used with:
LEFT(field, 300)
to solve this problem, and then a stored procedure is included in the Linq to SQL.dbml file to return a location object for the result.
However, I have many requests, and I do not want to do this for each request.
It may be a simple solution, but I'm not sure how I can indicate it in a search engine, I would be grateful to anyone who can help me with this problem.
source share