declare @sql nvarchar(2000)set @sql = 'select '+ stuff(isnull(','+@par1,'')+isnull(','+@par2,'')+...isnull(','+@par7,''),1,1,'')+' from tb'exec(@sql)一个道理,动态执行就可以了declare @sql nvarchar(2000)declare @where nvarchar(2000)set @where=N'where 1=1 'set @where=@where+ isnull('AND [a]='''+@a+'''','')+ isnull('AND ='''+@b
|