SqlServer中like 的查询一般我们都不推荐,但是当数据库某个字段的值是用分隔符区分的多个链接字符,比如,12,11,23等这样的类型。可能我们需要判断是否包含12.
这个时候我们想到的当然是like
除了like 其实我们可以用charindex函数来判断
like一般都是走全表扫描会很慢。如果用charindex 就是走字段
charindex('12','124578')>0 表示存在