日期:2014-05-18 浏览次数:20583 次
EXECUTE 分页过程名字 10,'查询的字段',1,'AND ", "+S_Types+"," LIKE "%, 1,%" ' ,1,15,0,30.0,'表1 LEFT JOIN 表2','表1.[id] = 表2.UserID','',''
Replace(@WhereStr,'"','''')
SELECT TOP 10 查询的字段 FROM 表1 LEFT JOIN 表2 ON 表1.[id] = 表2.UserID WHERE 其他WHERE条件 AND ', '+S_Types+',' LIKE '%, 1,%' ORDER BY 排序条件
--参考一下 下面这句 declare @sql varchar(max) declare @S_Types varchar(120) set @S_Types='col_name' set @sql='select top 10 * from a left join b on a.id=b.userid where ..... and '+@S_Types+' like ''%,1,%'' order by [排序条件] ' print @sql /* select top 10 * from a left join b on a.id=b.userid where ..... and col_name like '%,1,%' order by [排序条件] */
------解决方案--------------------
EXECUTE 分页过程名字 10,'查询的字段',1,'AND ", "+表1.S_Types+"," LIKE "%, 1,%" ',......
------解决方案--------------------
EXECUTE 分页过程名字 10,'查询的字段',1,'AND ", "+S_Types+"," LIKE "%, 1,%" ' ,
这里 S_Types 是你传入的参数还是查询条件里的字段名。。。
------解决方案--------------------
确认表1有S_Types字段吗?
确认那个print出来的SQL能执行通过吗.
------解决方案--------------------
S_Types --> 表2.S_Types