SQL替代LIKE [英] SQL substitute for LIKE
本文介绍了SQL替代LIKE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
LIKE是否有替代方法,当给定值为空字符串时返回所有记录?谢谢。
Is there an alternative for LIKE that returns all the records when the given value is an empty string? Thanks.
推荐答案
试试这个......
Hi,
Try this...
Select * from yourTable where name = case when isnull(@para,'') ='' Then name else @para end
希望这会对你有所帮助。
干杯
Hope this will help you.
Cheers
您不需要LIKE
运算符:您可以直接使用=
运算符,例如
You don't need theLIKE
operator: you may directly use the=
operator, e.g.
select * from mytable where name=''
这篇关于SQL替代LIKE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文