CREATE DATABASE [beszuras]
Go
-- DROP TABLE [szamolotabla]
use [beszuras]
CREATE TABLE [dbo].[szamolotabla](
[uid] bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,
[szamolo] [bigint] NOT NULL,
[datumido] [datetime2](7) NULL,
) ON [PRIMARY]
---------------- insert 40000 rows
--DECLARE @Loops INT SET @Loops = 1
DECLARE @CPU INT SET @CPU = @@CPU_BUSY
DECLARE @StartDate DATETIME SET @StartDate = GETDATE()
SET NOCOUNT ON
-- use [beszuras]
DECLARE @i int = 1;
WHILE @i < 40000
BEGIN
SET @i += 1;
-- WAITFOR DELAY '0:00:01';
INSERT INTO [dbo].[szamolotabla] ([szamolo], datumido) VALUES (@i,GetDate() );
END;
PRINT 'Total CPU time: ' + CONVERT(varchar, @@CPU_BUSY - @CPU)
PRINT 'Total milliseconds: ' + CONVERT(varchar, DATEDIFF(ms, @StartDate, GETDATE()))
----------------------- drop database
EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'beszuras'
GO
USE [master]
GO
ALTER DATABASE [beszuras] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE [master]
GO
DROP DATABASE [beszuras]
GO