declare@newstrvarchar(100) set@newstr='无'--新字符 declare@tablevarchar(256) set@table='year2004'--表 declare@upcolvarchar(8000) declare tb cursor local for selectupcol='update ['+b.name+'] set ['+a.name+']='''+@newstr+''' where ['+a.name+'] is null' from syscolumns a join sysobjects b on a.id=b.id where b.xtype='U'and a.status>=0 and a.xusertype in(175,239,231,167) and b.name=@table open tb fetchnextfrom tb into@upcol while@@fetch_status=0 begin exec(@upcol) fetchnextfrom tb into@upcol end close tb deallocate tb