我是靠谱客的博主 会撒娇酸奶,这篇文章主要介绍搜索sql语句,现在分享给大家,希望可以做个参考。

CREATE procedure dbo.select_a
    @b varchar(50),
    @c varchar(50),
    @d varchar(50),
    @e varchar(50)
as
declare @strsql varchar(5000) ;
set @strsql='select * from a where 1=1  ';
if @b <>'' 
set @strsql= @strsql+' and b="'+@b +'"';
if @c <>'' 
set @strsql= @strsql+' and c="'+@c +'"';
if @d <>'' 
set @strsql= @strsql+' and d="'+@d  +'"';
if @e <>'' 
set @strsql= @strsql+' and  e="'+@e +'"';

exec (@strsql)
GO


最后

以上就是会撒娇酸奶最近收集整理的关于搜索sql语句的全部内容,更多相关搜索sql语句内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(235)

评论列表共有 0 条评论

立即
投稿
返回
顶部