域名

教您如何使用SQL语句逐条更新每条记录

时间:2010-12-5 17:23:32  作者:应用开发   来源:IT科技类资讯  查看:  评论:0
内容摘要:复制-------------------------以下为逐条更新语句 declare@iint declare@jint d

教您如何使用SQL语句逐条更新每条记录
教何句逐复制-------------------------以下为逐条更新语句   declare @i int   declare @j int   declare @ID int   set @j=1 select  @i=count(*) from t_CaiWuTable05   DECLARE t_CaiWuTable05_cursor CURSOR FOR SELECT AutoId FROM t_CaiWuTable05    OPEN t_CaiWuTable05_cursor    while @j<=@i   begin   FETCH NEXT  FROM t_CaiWuTable05_cursor into @ID   update t_CaiWuTable05 set ZJBL=rtrim(ZJBL+cast(@j as char)) where AutoId=@ID   set @j=@j+1   end   CLOSE t_CaiWuTable05_cursor    DEALLOCATE t_CaiWuTable05_cursor   1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.
copyright © 2025 powered by 编程之道  滇ICP备2023006006号-34sitemap