create procedure atob( @type varchar(50))asdeclare @sql varchar(1000)set @sql='insert into b(id)select id from A where 1=1'if @type <>''set @sql =@sql +' and a.type='''+@type+''''exec(@sql)