Create a linq expression tree on a decimal property

Posts   
 
    
walikha
User
Posts: 8
Joined: 09-Sep-2010
# Posted on: 09-Sep-2010 09:42:27   

I have the following expression to use in a where clause

(WageConstIn => Convert.ToString(WageConstIn.SerialNo).StartsWith("28"))

It generates the following sql

SELECT * FROM WAGE_CONST_IN WHERE ( CAST(SERIALNO AS NVARCHAR2(2000)) LIKE '28%')

This does not seem to return any result. If i change the length of NVARCHAR from 2000 to 20 it then returns results. How can i change the result query from the query expression or create it in another way altogether cause the SQL I desire is as follows:

SELECT * FROM WAGE_CONST_IN WHERE ( SERIALNO LIKE '28%')

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 09-Sep-2010 11:10:28   

What's the database type of the SERIALNO?

walikha
User
Posts: 8
Joined: 09-Sep-2010
# Posted on: 09-Sep-2010 13:37:53   

Its is of type decimal.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Sep-2010 07:37:29   

I think you will need to use FunctionMappings here, to generate the function exactly as you want.

Here are some example threads: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15730

David Elizondo | LLBLGen Support Team