现在用sql语句查出来字段里包含某个字符串的所有记录怎么查

如题所述

一般用substring函数截取出特定字段,如
--用户姓名第二个字是'大'字的
select * from Users where SUBSTRING(UserName,2,1)='大'
第二种方法就是直接like模糊查询,看具体情况使用
select * from Users where UserName like '%大%'

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-06-11
select * from 表 where 字段 like '%字符串%'

第2个回答  2015-06-11
charindex() != 0
相似回答