22,209
社区成员
发帖
与我相关
我的任务
分享
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+'')