create proc test ( @a char(1), @b char(1), @c char(1) ) as declare @sql varchar(max) set @sql='select p.col1,p.col2 from(' if(@a=1) begin set @sql+='select col1 ,col2 from a union ' end if(@b=1) begin set @sql+='select col1 ,col2 from b union ' end if(@c=1) begin set @sql+='select col1,col2 from c' end set @sql+=')p'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)