Here is an example script that I wrote:declare @comp_id intdeclare @terminal_ID intdeclare @unified_address bigintdeclare @counter intdeclare @another_counter intdeclare @yet_another_counter int declare @not_another intset @comp_id = 11958set @counter = 0set @yet_another_counter = 0set @not_another = 2-- This will add 6000 terminals to 1 companywhile @comp_id < 11959BEGIN while @counter < 6001 BEGIN SELECT @unified_address = 59800000 + @counter INSERT INTO gt.dbo.TERMINAL_GT ( Terminal_UA, AssetID, company_id, LastStatusChangeDate, RecordCreate_DT, RegistrationStatus, TerminalPowerState, Deactivated, isTerminalOwner ) VALUES ( @unified_address, 0, @comp_id, getdate(), getdate(), @not_another, @yet_another_counter, 0, 1 ) SELECT @terminal_ID = terminal_GT_ID FROM gt.dbo.TERMINAL_GT WHERE Terminal_UA = @unified_address EXEC gt.dbo.isp_InsertParmValues @terminal_ID SET @counter = @counter + 1 IF @yet_another_counter = 5 SET @yet_another_counter = 0 ELSE SET @yet_another_counter = @yet_another_counter + 1 IF @not_another = 5 SET @not_another = 0 ELSE SET @not_another = @not_another + 1 END SELECT @comp_id = @comp_id + 1END-- This will add 10 terminals to 399 companiesset @another_counter = 1while @comp_id < 12358BEGIN while @another_counter < 11 BEGIN SELECT @unified_address = 59800000 + @counter INSERT INTO gt.dbo.TERMINAL_GT ( Terminal_UA, AssetID, company_id, LastStatusChangeDate, RecordCreate_DT, RegistrationStatus, TerminalPowerState, Deactivated, isTerminalOwner ) VALUES ( @unified_address, 0, @comp_id, getdate(), getdate(), @not_another, @yet_another_counter, 0, 1 ) SELECT @terminal_ID = terminal_GT_ID FROM gt.dbo.TERMINAL_GT WHERE Terminal_UA = @unified_address EXEC gt.dbo.isp_InsertParmValues @terminal_ID SET @counter = @counter + 1 SET @another_counter = @another_counter + 1 IF @yet_another_counter = 5 SET @yet_another_counter = 0 ELSE SET @yet_another_counter = @yet_another_counter + 1 IF @not_another = 5 SET @not_another = 0 ELSE SET @not_another = @not_another + 1 END set @another_counter = 1 select @comp_id = @comp_id + 1END
Tara