以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 求助一个存储过程传递参数问题! (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=95431) |
-- 作者:有点色 -- 发布时间:2017/1/19 16:14:00 -- Set @strr = \'\'\'\' + @strr + \'\'\'\'
a.区域 in (@strr) |
-- 作者:有点色 -- 发布时间:2017/1/19 17:33:00 -- 直接写,看能不能出来结果
a.[Date] >= @date1 and a.[Date] <= @date2
然后写,看能不能出结果
a.[Date] >= @date1 and a.[Date] <= @date2 and a.[区域] in (\'\'\'杭州\'\', \'\'苏州\'\'\') [此贴子已经被作者于2017/1/19 17:34:52编辑过]
|
-- 作者:有点色 -- 发布时间:2017/1/19 17:44:00 -- 哦,好像要用 Exec 执行
@strr =\'\'\'杭州\'\',\'\'苏州\'\'\' EXEC(\'SELECT * FROM tbname WHERE a.[Date] >= @date1 and a.[Date] <= @date2 and a.[区域] in (\' + @strr + \')\') |