首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

查询字串如何加过滤条件,就是查询包含特定字串的记录

2012-02-19 
查询字串怎么加过滤条件,就是查询包含特定字串的记录比如一个字段是文本型,现在需要查找包含 “abcdefg”这

查询字串怎么加过滤条件,就是查询包含特定字串的记录
比如一个字段是文本型,现在需要查找包含 “abcdefg”这样字串的记录。sql语句怎么写?

[解决办法]
select * from tb where 字段 like '%abcdefg%'

select * from tb where charindex('abcdefg' , 字段) > 0 

select * from tb where cast(字段 as varchar) like '%abcdefg%'

select * from tb where charindex('abcdefg' , cast(字段 as varchar)) > 0

热点排行