how do i create a predicate that is equivalent to this sql
SELECT * FROM vehicle WHERE IsNumeric(LEFT(wheelbase,3))=1 AND CAST(LEFT(wheelbase,3) as int)>175
version 2.6 final SelfServicing .NET 3.5 SqlServer 2005
thanks.
Terry Treangen
Hi Terry,
You should use DBFunctionCalls.
Here are some examples: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15487&StartAtMessage=0𕃸 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=16265&StartAtMessage=0𖊸
As you have one function inside other, you could do it something like:
EntityField isNumericLeftPart = new EntityField("IsNumericField", new DbFunctionCall("IsNumeric", new object[] { new DBFunctionCall("LEFT", new object[] { wheelbase, 3}) })); filter.Add(isNumericLeftPart == 1);
The same applies to the second filter ( CAST(LEFT) )
worked.