linq - 像 SQL 的 linq 查询和 sql server 2008 的 Soudex 是什么?

标签 linq sql-server-2008

在sql server中,我们可以发出sql来获取数据,如

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

要匹配上面的 sql 的 linq 查询是什么?

最佳答案

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

在 .Net 4.0 中你可以使用 SoundCode 函数,大概是这样的:

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

关于linq - 像 SQL 的 linq 查询和 sql server 2008 的 Soudex 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1561664/

相关文章:

sql - SQL女士发送邮件

sql - 在 SQL Server 中的文本字段上使用 LEFT

sql-server - 在存储过程中返回 True 或 False 值

c# - SqlDataReader - 如何将当前行转换为字典

c# - 使用 lambda 语法与匿名类型进行多个 linq 连接

c# - Expression.Body 作为 MemberExpression 为原始属性返回 null

sql - 转换失败 (SQL Server 2008)

c# - 无法在泛型委托(delegate)中推断出类型

c# - 使用 Linq 仅从集合中选择子类

sql - 向超过 16 列的唯一行添加约束