我有两种 
select * from t_Customer where (cSourName =@cSourName or @cSourName is null or @cSourName = '' ) and ( cValueName =(@cValueName) or @cValueName is null or @cValueName = '' ) and ( cRankName =(@cRankName) or @cRankName is null or @cRankName = '' ) and (cTypeName = (@cTypeName)or @cTypeName is null or @cTypeName = '' ) 
 跟 
exec ('select * from t_Customer as cus,t_User as u  where cus.cUserID=u.cUserID and cSourName in ('+@cSourName+') and cValueName in ('+@cValueName+') and cRankName in ('+@cRankName+') and cTypeName in ('+@cTypeName+') 
第一种只能实现一个参数传递,第二种如果有空的查询,就只能查询带空的记录。大家看看有没什么好的办法。我想实现的效果是,我选中一些checkbox的时候,
select * from t_customer where cSourName in ('百度推广', '朋友介绍') and cValueName in ('')当cValueName 传如的值为空的时候,只需查询前面的cSourName 条件的所有数据。