日期:2014-05-18 浏览次数:20573 次
declare @str varcahr(100)='select id' if(select col1 from tb where id=@id) is not null set @str=@str+',col1' if(select col2 from tb where id=@id) is not null set @str=@str+',col3' ... exec(@str+' where id='''+@id+'')