Home Forums SQL Server 2005 Development need script to generate load on tempdb databse!!! RE: need script to generate load on tempdb databse!!!

  • RBarryYoung (2/6/2010)


    Well, I am no fan of loops, but since the goal IS to slow things down, this ought to do it:

    CREATE PROC EXERCISE_TEMPDB_SILLY AS

    SET STATISTICS TIME ON

    SET STATISTICS IO ON

    CREATE TABLE #temp(RecNo INT PRIMARY KEY CLUSTERED, Data varchar(80))

    INSERT INTO #temp SELECT -1, CAST(NewID() AS varchar(80))

    DECLARE @cnt AS INT

    SET @cnt = 0

    WHILE @cnt > -1

    BEGIN

    Print 'Loop ' + CAST(@cnt AS VARCHAR(9))

    INSERT INTO #temp

    SELECT RecNo-Power(2,@cnt) , Right(Data + CAST(NewID() AS varchar(80)), 80)

    FROM #temp

    SET @cnt = @cnt+1

    END

    hiii RBarryYoung,

    on my server its going beyond 21 loops

    so finally i have to kill this SP

    tell me exactly whether this SP goes in infinite loop or will finish after some time?

    Sanket Ahir
    Don't run behind the success, Try to be eligible & success will run behind u......