sql contains 用法

时间:2016-06-19 17:04:32   收藏:0   阅读:956

select * from tb where charindex(‘abcdefgh‘,name)>0
select * from tb where patindex(‘%abcdefgh%‘,name)>0

select * from tblTest where ‘abcdefgh‘ like ‘%‘+name+‘%‘
Select * from tblTest where name like ‘%abcdefgh%‘
select * from tblTest where replace(‘abcdefgh‘,name,‘‘) < 8


declare @str varchar(100)
set @str=‘abcdefgh‘
select * from tblTest where @str like ‘%‘+name+‘%‘
--> or
select * from tblTest where replace(@str,name,‘‘)<>@str


select name from tab where replace(name,‘abcd‘,‘‘)<>name 通杀...

 

记录一下,经常用到。

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!