Page 1 of 1

Oracle/linq like command

Posted: Fri 02 Oct 2009 11:37
by Trixz
Ok, when i run a linq query i can get a like with this syntax

Code: Select all

var x = (from t in context.table
where t.column.startsWith("MyString")
select t);

sql
select t.* from table t where t.column like 'MyString%'

I can also use endWith or contains.
But what if I want to have a sql command that results in

Code: Select all

select t.* from table t where t.column like 'My%String'
is it possible?

Posted: Fri 02 Oct 2009 11:46
by Trixz
Found it ... did not search ok

Answer: use SqlMethods.Like

Code: Select all

from t in context table
where SqlMethods.Like(t.column, 'My%str_ng'