如题,有一变量,varchar类型,[email protected]= 'adfadas '
有一张表,其中有一个字段也为varchar类型,例如:
id text1 ...
1 ad
2 as
3 ae
4 efg
现在要把表中的text1中的字段,[email protected],就查询出来,要求全字匹配。
如上面的例子,ad [email protected],则查询出
1 ad
3 ae
请问语句该如何写?
------解决方案--------------------
Select * From 表 Where CharIndex(text1, @a) > 0
------解决方案--------------------
select * from 表 where charindex(text1,@a)> 0