Generate Dummy Data

Generate dummy data and insert it into table dbo.dummydata


-- // create table to store data

drop table if exists dbo.dummydata
GO
create table dbo.dummydata
(
    Id int,
    randomdata uniqueidentifier
)

declare @cnt int = 100

while @cnt > 0 

begin 
-- // Generate 50000 random rows

    declare @datetime datetime = getdate()
    ;with randowvalues
        as(
           select 1 id, NEWID() randomnumber
            union  all
            select id + 2, NEWID() randomnumber
            from randowvalues
            where 
              id < 100000-1
          )

        insert into dbo.dummydata(Id, randomdata)
        select *
        from randowvalues
        OPTION(MAXRECURSION 0)

    set @cnt = @cnt-1

    declare @msg varchar(255)
    set     @msg = concat('duration batch: ',datediff(ms, @datetime, getdate()), ' (ms)')

    RAISERROR(@msg, 0, 1) WITH NOWAIT

end