-- Don't want 25M "1 Row inserted" messages!
SET nocount ON
-- Some timing stuff, see how fast it is.
DECLARE @a DATETIME,
@b DATETIME
SET @a = current_timestamp
-- Create a temporary table to create a multiplier factor.
DECLARE @myTable TABLE (id INT)
-- Add 5000 rows to our dummy table.
DECLARE @counter INT
SET @counter = 0
WHILE @counter < 5000
BEGIN
SET @counter = @counter + 1
INSERT INTO @myTable VALUES (@counter)
END
-- This is the big multiplier.. a cartesian product is 5000*5000=25M rows! We
-- don't even need to select from the tables, but if we want we could use the
-- numbers for something..
INSERT INTO uw_containers (type_id)
SELECT 1 FROM @myTable a, @myTable b
-- Now create a history event for each of the new containers.
INSERT INTO uw_container_history
(containerid,label,effectivestart,effectiveend,eventstartid)
SELECT
id,'C' + CAST(id AS varchar(50)),Getdate(),'12/31/9999',139059
FROM
uw_containers
SET @b = current_timestamp
SELECT Datediff(ms, @a, @b)