日期:2014-05-18 浏览次数:20470 次
select a.* from song a inner join ...附属表1 on .. inner join ...附属表2 on .. where songname like '%' + isnull(nullif(@songname,''),songname) + '%' and AlbumsName like '%' + isnull(nullif(@AlbumsName,''),AlbumsName) + '%' and Composer = isnull(nullif(@Composer),Composer ) and ... 这样就可以了,无论参数给''这样的空字串,还是null值,都可以进行匹配.具体的我就不写了,你自己跟具需要处理一下.