SqlServer 中 Like 带参 与 In带参的用法详解
程序员文章站
2022-03-23 14:18:31
like带参
商品表commodity,@remark2的值直接是字符串 string remark2=”测试商品”
select commodityid,price,...
like带参
商品表commodity,@remark2的值直接是字符串 string remark2=”测试商品”
select commodityid,price,commodityname,commoditycode from commodity where disabled=@disabled1 and remark like '%'+@remark2+'%'
in带参
商品表commodity,@commoditycodes的值直接是字符串 string commoditycodes=“‘c0001’,’c0002’,’c0005’”
exec('select commodityid,price,commodityname,commoditycode from commodity where disabled=0 and commoditycode in ('+@commoditycodes+') ')