use USER_DB
declare @usertablename sysname
declare @sqlstr varchar(5000)
declare @newcd varchar(50)
declare @oldcd varchar(50)
declare my_cursor1 cursor for
select name from sysobjects where xtype = 'U' order by name;
set @newcd = '0101150842020402'
set @oldcd = '0101150842020300'
open my_cursor1
fetch next from my_cursor1
into @usertablename
while @@FETCH_STATUS = 0
begin
print @usertablename
set @sqlstr = 'update '+@usertablename+' set ENTERPRISECODERF = '''+@newcd+''' where ENTERPRISECODERF = '''+@oldcd+''''
print @sqlstr
EXEC (@sqlstr)
fetch next from my_cursor1
into @usertablename
end
CLOSE my_cursor1
DEALLOCATE my_cursor1
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步