可以采用exec方法
declare @tempStr varchar(350)
select @tempStr='Update weekcount set [' convert(varchar,@week) ']=[' convert(varchar,@week) '] 1 where
userid=''' replace(@user,'''','''''') ''''
exec(@tempStr)
注意: 使exec不能返回一些变量的值,而且当前的变量值在exec的语句里无效.
http://www.bkjia.com/PHPjc/631206.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631206.htmlTechArticle可以采用exec方法 declare @tempStr varchar(350) select @tempStr='Update weekcount set [' convert(varchar,@week) ']=[' convert(varchar,@week) '] 1 where userid=''' replace(@user...