KentZhou
KentZhou

Reputation: 25553

What the linq query for SQL like and Soudex for sql server 2008?

In sql server, we can issue sql to get data like

select * from table where column like '%myword%'
select * from person where Soundex(LastName) =  Soundex('Ann')

what's the linq query to match above sql?

Upvotes: 3

Views: 942

Answers (2)

Gabe
Gabe

Reputation: 86708

from t in table
where t.column.Contains("myword")
select t

In .Net 4.0 you can use the SoundCode function, probably like this:

from p in person
where SqlFunctions.SoundCode(p.LastName) == SqlFunctions.SoundCode('Ann')
select p

Upvotes: 2

Related Questions