Possible Duplicate:
Does Linq have "Difference"?
How to convert the following SQL Query to Linq
SELECT * FROM Designation WHERE DIFFERENCE(EmpDesg, ‘Engineer’) >= 3
You need to write a stored procedure and bring it into your context, define a user-defined function (if you're using EF) or you need to be willing to just execute a raw SQL query through the context. You can't access DIFFERENCE
using LINQ to SQL directly (there is no LINQ query opeartor that will be translated into T-SQL DIFFERENCE
).
Does Linq have "Difference"?
Summary:
- Create User-Defined SQL Function
- Add that function to your DBML diagram
- Call that function in your
WHERE
clause
精彩评论