在SQL查询分析器里写了一个存储过程
CREATE  procedure dbo.TestFlux8
@i int
as
BEGIN
IF @i<100
insert into yonghu(yh_id,yh_name,yh_password) values('5','5','5')
set @i = @i+1
END;
已经成功运行呀。可执行的时候去老通不过。。Exec TestFlux8(0);

解决方案 »

  1.   

    不知道LZ要不要循环,set @i = @i+1起什么作用?CREATE  procedure dbo.TestFlux8
      @i int
    as
    BEGIN
      IF @i<100
        begin
          insert into yonghu(yh_id,yh_name,yh_password) values('5','5','5')
          set @i = @i+1
        end
    END
      

  2.   

    CREATE  procedure dbo.TestFlux8
      @i int
    as
    BEGIN
      while @i<100
        begin
          insert into yonghu(yh_id,yh_name,yh_password) values('5','5','5')
          set @i = @i+1
        end
    END
    if 只能执行一次,这样就可以了!