/* DB Stress Tool - Test. Author: Michael Thomas - michael@michael-thomas.com Original: 06/26/07 Modified: 06/26/07 Description: Places a stressload on the DB Server. Prerequisites: 1. Run the Setup SQL 1 time to setup the DB and Tables. 2. Change the variable @strUniqueTestCode with a unique value for each instance of your test. You can run multiple tests on a server. 3. Change the @intLoopsMax the value you desire. This is how many times you will loop through the insert/update/delete commands. (Note: You can always stop/cancel the routine via SQL Query analyzer's red stop icon.) */ use MyTempDB_StressTool DECLARE @strUniqueTestCode nvarchar(20) DECLARE @intLoopsMax int set @strUniqueTestCode = 'TestA' -- Change this code for every instance of your test. set @intLoopsMax = 10 -- 1000000 (1 Million) - suggested for long running test. SET NOCOUNT ON DECLARE @intLoops int SET @intLoops = 1 WHILE @intLoops <= @intLoopsMax BEGIN insert into MyStressData select id, row, (@strUniqueTestCode + ':' + code) as 'code', description from MyStressData where code like 'Default:%' update MyStressData set description = ('Updated:' + description) where code like (@strUniqueTestCode + ':%') delete from MyStressData where code like (@strUniqueTestCode + '%') -- PRINT 'Loop #' + convert(nvarchar(30), @intLoops) + ' - Completed.' SET @intLoops = @intLoops + 1 END SET NOCOUNT OFF PRINT 'Finished running test: ' + @strUniqueTestCode + ' ' + convert(nvarchar(30), @intLoops) + ' times.' GO use master /* use MyTempDB_StressTool select count(*) from MyStressData select * from MyStressData */