-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDB_Stress_Script.sql
More file actions
52 lines (46 loc) · 1005 Bytes
/
Copy pathDB_Stress_Script.sql
File metadata and controls
52 lines (46 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
USE [AdventureWorks2008R2]
GO
SET NOCOUNT ON
DECLARE @START INT, @STOP INT
DECLARE @@TMP AS TABLE(
[SalesOrderID] [int] ,
[SalesOrderDetailID] [int],
[CarrierTrackingNumber] [nvarchar](25) ,
[OrderQty] [smallint] ,
[ProductID] [int] ,
[SpecialOfferID] [int] ,
[LineTotal] NUMERIC(38,6),
[rowguid] [uniqueidentifier] ROWGUIDCOL ,
[ModifiedDate] [datetime]
)
SET @START=0 ; SET @STOP = 10 -- Nb transaction
WHILE (@START < @STOP)
BEGIN
BEGIN TRAN
;WITH cte ([SalesOrderID]
,[SalesOrderDetailID]
,[CarrierTrackingNumber]
,[OrderQty]
,[ProductID]
,[SpecialOfferID]
,[LineTotal]
,[rowguid]
,[ModifiedDate]
)AS (
SELECT top 10000000
p1.[SalesOrderID]
,p1.[SalesOrderDetailID]
,p1.[CarrierTrackingNumber]
,p1.[OrderQty]
,p1.[ProductID]
,p1.[SpecialOfferID]
,p1.[LineTotal]
,p1.[rowguid]
,p1.[ModifiedDate]
FROM [Sales].[SalesOrderDetail] p1
CROSS APPLY [Sales].[SalesOrderDetail] p2
)
INSERT INTO @@TMP SELECT * FROM cte
SET @START = @START + 1
COMMIT TRAN
END