你的问题欠详细内容,如用SQLserver,一条Update语句也能完成简单的循环。
烦内容陈述详细一点。

解决方案 »

  1.   

    for没用过,用 while 试试。
      

  2.   

    好像我觉得sql不需要什么for的逻辑,其实只要加where + 条件 就可以完成了
      

  3.   

    in oracle:
       For i In 1 .. 10 Loop
          ...
       End Loop;
      

  4.   

    我用的是 interbase 的数据库
    我不会在 SQL 中用  while... do
    请高手们写详细一些好吗??
      

  5.   

    sql语句加个where就可以了没必要用while
      

  6.   

    用 WHERE 这个我知道,可我现在要实现一个例如:
       for i=1 to 100 do
       begin
       end;
    的循环,拜托了。
      

  7.   

    我要实现的功能再delphi 中是这样的:
      k:=1;
      m:=1;
      for i:=1 to 100 do
      begin
        with tables do
        begin 
          append;
          fieldbyname('col1').asinteger:=k;
          fieldbyname('col2').asstring:=m;  
          post;
          k:=k+1;
          m:=m+1;
         \  ......其他语句 .........
         \    end;
      end;
    请问怎样改成 SQL 的???????
      

  8.   

    DECLARE @I int
    set @I = 1
    WHILE @I <= 100
    BEGIN
      INSERT INTO TABLE1 (aa, bb)
      VALUES(@I, @I)
      set @I = @I + 1
    END