当前位置: 当前位置:首页 >应用开发 >逐条更新数据的SQL语句写法正文

逐条更新数据的SQL语句写法

作者:数据库 来源:应用开发 浏览: 【】 发布时间:2025-11-05 11:20:33 评论数:
逐条更新数据的SQL语句写法
复制declare @tid int           declare @fid int   declare @i int   declare @j int   set @j=(select count(*) from tbl1.dbo.dnt_topics)   set @i=1 while   @i<@j            begin                    set @tid = (select tid from ( select ROW_NUMBER() over (order by tid asc ) as Row,逐条 tid,fid from dnt_topics ) as sp  where Row=@i)       set @fid=(select fid from ( select ROW_NUMBER() over (order by tid asc ) as Row, tid,,fid from dnt_topics ) as sp  where Row=@i)                        update                        tbl2.dbo.dnt_topics                 set                     fid=@fid                where                 tid=@tid                                set @i=@i+1      1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.

最近更新