select id,name,old from table where charindex(变量,name) > 0
declare @name varchar(2000) set @name='XXX' select id,title from Tab_Info where title like '%'+@name+'%'或 name=... strSQL="select id,title from Tab_Info where title like '%"&name&"%'" Conn.Execute(strSQL)
set @name='XXX'
select id,title from Tab_Info where title like '%'+@name+'%'或
name=...
strSQL="select id,title from Tab_Info where title like '%"&name&"%'"
Conn.Execute(strSQL)
返回字符串中指定表达式的起始位置。 语法
CHARINDEX ( expression1 , expression2 [ , start_location ] ) 参数
expression1一个表达式,其中包含要寻找的字符的次序。expression1 是一个短字符数据类型分类的表达式。expression2一个表达式,通常是一个用于搜索指定序列的列。expression2 属于字符串数据类型分类。start_location在 expression2 中搜索 expression1 时的起始字符位置。如果没有给定 start_location,而是一个负数或零,则将从 expression2 的起始位置开始搜索。返回类型
int