你试试用一个变量取得GETDATE()的值 然后用变量代替GETDATE()

解决方案 »

  1.   

    ---test1.create table table1(ff nvarchar(10),ffff datetime)2.CREATE PROCEDURE test0529
    (@i int,
    @con int out
    )
    AS
    BEGIN TRAN
    set xact_abort on
    WHILE (@i<10)
    begin
    INSERT INTO table1
          (ff,ffff)
    VALUES ('fff',getdate() )
    set @i=@i+1
    end
    commit  tran
    set @con=@i
    GO3.declare @i int
      exec test0529 1,@i out
      select @i
      select * from table14.drop procedure test0529
      drop table table1
      

  2.   

    搞定了
    set  @i=1
    少写了一句 
      

  3.   

    @i在这个时候为NULL,你应该先复值!set @i=0