I am doing a little
demo this week and it includes a simple SQL Server script to generate
activity on the network while I demo SMB2 durability.
First, the database is created:
First, the database is created:
USE [Master]
GO
GO
CREATE DATABASE [Sales] ON PRIMARY
( NAME = N'Sales', FILENAME = N'\\FSA\SQLDB\Sales.mdf' ,
SIZE = 2GB , MAXSIZE = 8GB, FILEGROWTH = 1GB )
LOG ON
( NAME = N'Sales_log', FILENAME = N'\\FSA\SQLDB\Sales_log.ldf' ,
SIZE = 1GB , MAXSIZE = 2GB , FILEGROWTH = 10%)
GO
( NAME = N'Sales', FILENAME = N'\\FSA\SQLDB\Sales.mdf' ,
SIZE = 2GB , MAXSIZE = 8GB, FILEGROWTH = 1GB )
LOG ON
( NAME = N'Sales_log', FILENAME = N'\\FSA\SQLDB\Sales_log.ldf' ,
SIZE = 1GB , MAXSIZE = 2GB , FILEGROWTH = 10%)
GO
USE [Sales]
GO
GO
CREATE TABLE [dbo].[Product]
(
[ProductId] [uniqueidentifier] DEFAULT NEWID() NOT NULL,
[ProductName] [nchar](50) NULL,
[ProductDescription] [nchar](3000) NULL,
[ProductPrice] MONEY NULL
) ON [PRIMARY]
GO
Then, the script to keeps the database a little busy:(
[ProductId] [uniqueidentifier] DEFAULT NEWID() NOT NULL,
[ProductName] [nchar](50) NULL,
[ProductDescription] [nchar](3000) NULL,
[ProductPrice] MONEY NULL
) ON [PRIMARY]
GO
USE [Sales]
GO
WHILE (1=1)
BEGIN
TRUNCATE TABLE [Sales].[dbo].[Product]
DECLARE @Record INT
SET @Record=1
WHILE @Record<=10000
BEGIN
INSERT INTO [Sales].[dbo].[Product]
([ProductName] ,[ProductDescription],[ProductPrice])
VALUES ('Product ' + STR(@Record), 'Description ' + STR(@Record), @Record*100/3)
SET @RECORD = @RECORD+1
END
SELECT COUNT(ProductID) as RecordsCreated FROM [Sales].[dbo].[Product]
END
Simple stuff. Just so SQL Server can generate some activity that can
be shown in Task Manager's Network tab while other things happen... :-)GO
WHILE (1=1)
BEGIN
TRUNCATE TABLE [Sales].[dbo].[Product]
DECLARE @Record INT
SET @Record=1
WHILE @Record<=10000
BEGIN
INSERT INTO [Sales].[dbo].[Product]
([ProductName] ,[ProductDescription],[ProductPrice])
VALUES ('Product ' + STR(@Record), 'Description ' + STR(@Record), @Record*100/3)
SET @RECORD = @RECORD+1
END
SELECT COUNT(ProductID) as RecordsCreated FROM [Sales].[dbo].[Product]
END
0 Response to "Simple SQL Server script to create a database and generate activity for a demo"
Post a Comment