Skip to content

Commit f9dd767

Browse files
authored
Merge pull request #1218 from Foundatum/master
Fixing Build of WideWorldImporters DB
2 parents 177ff48 + fc28625 commit f9dd767

File tree

58 files changed

+9740
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+9740
-275
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,4 @@ samples/features/sql-management-objects/src/out/CodeCoverage/CodeCoverage.config
444444

445445
# Composer
446446
/vendor/
447+
/samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/WideWorldImporters.publish.xml

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/Application/Stored Procedures/Configuration_ApplyPartitioning.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BEGIN
2020
SET @SQL = N'
2121
CREATE PARTITION FUNCTION PF_TransactionDateTime(datetime)
2222
AS RANGE RIGHT
23-
FOR VALUES (N''20140101'', N''20150101'', N''20160101'', N''20170101'');';
23+
FOR VALUES (N''20210101'', N''20220101'', N''20230101'', N''20240101'');';
2424
EXECUTE (@SQL);
2525
END;
2626

@@ -29,7 +29,7 @@ FOR VALUES (N''20140101'', N''20150101'', N''20160101'', N''20170101'');';
2929
SET @SQL = N'
3030
CREATE PARTITION FUNCTION PF_TransactionDate(date)
3131
AS RANGE RIGHT
32-
FOR VALUES (N''20140101'', N''20150101'', N''20160101'', N''20170101'');';
32+
FOR VALUES (N''20210101'', N''20220101'', N''20230101'', N''20240101'');';
3333
EXECUTE (@SQL);
3434
END;
3535

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/AddSpecialDeals.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BEGIN
1010
SET NOCOUNT ON;
1111
SET XACT_ABORT ON;
1212

13-
IF CAST(@CurrentDateTime AS date) = '20151231'
13+
IF CAST(@CurrentDateTime AS date) = '20211231'
1414
BEGIN
1515
BEGIN TRAN;
1616

@@ -21,7 +21,7 @@ BEGIN
2121
VALUES
2222
(NULL, NULL, (SELECT BuyingGroupID FROM Sales.BuyingGroups WHERE BuyingGroupName = N'Wingtip Toys'),
2323
NULL, (SELECT StockGroupID FROM Warehouse.StockGroups WHERE StockGroupName = N'USB Novelties'),
24-
N'10% 1st qtr USB Wingtip', '20160101', '20160331', NULL, 10, NULL,
24+
N'10% 1st qtr USB Wingtip', '20220101', '20220331', NULL, 10, NULL,
2525
2, @StartingWhen);
2626

2727
INSERT Sales.SpecialDeals
@@ -31,7 +31,7 @@ BEGIN
3131
VALUES
3232
(NULL, NULL, (SELECT BuyingGroupID FROM Sales.BuyingGroups WHERE BuyingGroupName = N'Tailspin Toys'),
3333
NULL, (SELECT StockGroupID FROM Warehouse.StockGroups WHERE StockGroupName = N'USB Novelties'),
34-
N'15% 2nd qtr USB Tailspin', '20160401', '20160630', NULL, 15, NULL,
34+
N'15% 2nd qtr USB Tailspin', '20220401', '20220630', NULL, 15, NULL,
3535
2, @StartingWhen);
3636

3737
COMMIT;

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/AddStockItems.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BEGIN
2020

2121
DECLARE @NumberOfStockItems int = 0;
2222

23-
IF CAST(@CurrentDateTime AS date) = '20160101'
23+
IF CAST(@CurrentDateTime AS date) = '20220101'
2424
BEGIN
2525
SET @NumberOfStockItems = 2;
2626

@@ -35,7 +35,7 @@ BEGIN
3535

3636
COMMIT;
3737

38-
END ELSE IF CAST(@CurrentDateTime AS date) = '20160102'
38+
END ELSE IF CAST(@CurrentDateTime AS date) = '20220102'
3939
BEGIN
4040
SET @NumberOfStockItems = 2;
4141

@@ -50,7 +50,7 @@ BEGIN
5050

5151
COMMIT;
5252

53-
END ELSE IF CAST(@CurrentDateTime AS date) = '20160104'
53+
END ELSE IF CAST(@CurrentDateTime AS date) = '20220104'
5454
BEGIN
5555
SET @NumberOfStockItems = 2;
5656

@@ -65,7 +65,7 @@ BEGIN
6565

6666
COMMIT;
6767

68-
END ELSE IF CAST (@CurrentDateTime AS date) = '20160105'
68+
END ELSE IF CAST (@CurrentDateTime AS date) = '20220105'
6969
BEGIN
7070
SET @NumberOfStockItems = 2;
7171

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/DailyProcessToCreateHistory.sql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
CREATE PROCEDURE [DataLoadSimulation].[DailyProcessToCreateHistory]
33
@StartDate date
44
, @EndDate date
5-
, @AverageNumberOfCustomerOrdersPerDay int = 60
5+
, @AverageNumberOfCustomerOrdersPerDay int = 30
66
, @SaturdayPercentageOfNormalWorkDay int
77
, @SundayPercentageOfNormalWorkDay int
88
, @UpdateCustomFields bit
99
, @IsSilentMode bit
1010
, @AreDatesPrinted bit
11-
, @MinYearlyGrowthPercent int = 10
12-
, @MaxYearlyGrowthPercent int = 20
13-
, @MinSeasonalVariationPercent int = 30
14-
, @MaxSeasonalVariationPercent int = 50
11+
, @MinYearlyGrowthPercent int = -5
12+
, @MaxYearlyGrowthPercent int = 15
13+
, @MinSeasonalVariationPercent int = -10
14+
, @MaxSeasonalVariationPercent int = 30
1515
, @MaxDailyVariationPercent int = 20
1616

1717
AS
@@ -54,8 +54,8 @@ BEGIN
5454
DECLARE @MaxSeasonalVariationPercent int = 25
5555
DECLARE @MinYearlyGrowthPercent int = 3
5656
DECLARE @MaxYearlyGrowthPercent int = 30
57-
declare @StartDate date = '20130101'
58-
declare @EndDate date = '20180101'
57+
declare @StartDate date = '20200101'
58+
declare @EndDate date = '20230101'
5959
declare @CurrentDateTime datetime2 = @StartDate
6060
declare @MaxDailyVariationPercent int = 5
6161
@@ -367,7 +367,7 @@ BEGIN
367367
EXEC DataLoadSimulation.MakeTemporalChanges @CurrentDateTime, @StartingWhen, @EndOfTime, @IsSilentMode;
368368

369369
-- Record delivery van temperatures
370-
IF @CurrentDateTime >= '20160101'
370+
IF @CurrentDateTime >= '20220101'
371371
BEGIN
372372
IF @IsSilentMode = 0
373373
BEGIN
@@ -378,7 +378,7 @@ BEGIN
378378
END;
379379

380380
-- Record cold room temperatures
381-
IF @CurrentDateTime >= '20151220'
381+
IF @CurrentDateTime >= '20211220'
382382
BEGIN
383383
IF @IsSilentMode = 0
384384
BEGIN

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/MakeTemporalChanges.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ BEGIN
7070
END;
7171
END;
7272

73-
IF CAST(@StartingWhen AS date) = '20150101'
73+
IF CAST(@StartingWhen AS date) = '20210101'
7474
BEGIN
7575
UPDATE [Application].DeliveryMethods
7676
SET DeliveryMethodName = N'Chilled Van',
@@ -79,7 +79,7 @@ BEGIN
7979
WHERE DeliveryMethodName = N'Van with Chiller';
8080
END;
8181

82-
IF CAST(@StartingWhen AS date) = '20160101'
82+
IF CAST(@StartingWhen AS date) = '20220101'
8383
BEGIN
8484
UPDATE [Application].PaymentMethods
8585
SET PaymentMethodName = N'Credit-Card',
@@ -118,7 +118,7 @@ BEGIN
118118
WHERE StockGroupName = N'Footwear';
119119
END;
120120

121-
IF CAST(@StartingWhen AS date) = '20150101'
121+
IF CAST(@StartingWhen AS date) = '20210101'
122122
BEGIN
123123
UPDATE Purchasing.SupplierCategories
124124
SET SupplierCategoryName = N'Courier Services Supplier',
@@ -127,7 +127,7 @@ BEGIN
127127
WHERE SupplierCategoryName = N'Courier';
128128
END;
129129

130-
IF CAST(@StartingWhen AS date) = '20140101'
130+
IF CAST(@StartingWhen AS date) = '20200701'
131131
BEGIN
132132
INSERT Sales.CustomerCategories
133133
(CustomerCategoryName, LastEditedBy, ValidFrom, ValidTo)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CREATE PROCEDURE [DataLoadSimulation].[PopulateDataTo180DaysAgo]
2+
@AverageNumberOfCustomerOrdersPerDay int = 30,
3+
@SaturdayPercentageOfNormalWorkDay int = 25,
4+
@SundayPercentageOfNormalWorkDay int = 0,
5+
@IsSilentMode bit = 0,
6+
@AreDatesPrinted bit = 1
7+
AS
8+
BEGIN
9+
SET NOCOUNT ON;
10+
11+
DECLARE @CurrentMaximumDate date = COALESCE((SELECT MAX(OrderDate) FROM Sales.Orders), '20191231');
12+
DECLARE @StartingDate date = DATEADD(day, 1, @CurrentMaximumDate);
13+
DECLARE @EndingDate date = CAST(DATEADD(day, -1, SYSDATETIME()) AS date);
14+
15+
EXEC DataLoadSimulation.DailyProcessToCreateHistory
16+
@StartDate = @StartingDate,
17+
@EndDate = @EndingDate,
18+
@AverageNumberOfCustomerOrdersPerDay = @AverageNumberOfCustomerOrdersPerDay,
19+
@SaturdayPercentageOfNormalWorkDay = @SaturdayPercentageOfNormalWorkDay,
20+
@SundayPercentageOfNormalWorkDay = @SundayPercentageOfNormalWorkDay,
21+
@UpdateCustomFields = 0, -- they were done in the initial load
22+
@IsSilentMode = @IsSilentMode,
23+
@AreDatesPrinted = @AreDatesPrinted;
24+
25+
END;

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/PopulateDataToCurrentDate.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AS
99
BEGIN
1010
SET NOCOUNT ON;
1111

12-
DECLARE @CurrentMaximumDate date = COALESCE((SELECT MAX(OrderDate) FROM Sales.Orders), '20121231');
12+
DECLARE @CurrentMaximumDate date = COALESCE((SELECT MAX(OrderDate) FROM Sales.Orders), '20191231');
1313
DECLARE @StartingDate date = DATEADD(day, 1, @CurrentMaximumDate);
1414
DECLARE @EndingDate date = CAST(DATEADD(day, -1, SYSDATETIME()) AS date);
1515

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
CREATE PROCEDURE [DataLoadSimulation].[PopulateOneDayOfHistory]
2+
@AverageNumberOfCustomerOrdersPerDay int = 30,
3+
@SaturdayPercentageOfNormalWorkDay int = 25,
4+
@SundayPercentageOfNormalWorkDay int = 0,
5+
@IsSilentMode bit = 0,
6+
@AreDatesPrinted bit = 1
7+
AS
8+
BEGIN
9+
SET NOCOUNT ON;
10+
11+
DECLARE @CurrentMaximumDate date = COALESCE((SELECT MAX(OrderDate) FROM Sales.Orders), '20191231');
12+
DECLARE @StartingDate date = DATEADD(day, 1, @CurrentMaximumDate);
13+
14+
EXEC DataLoadSimulation.DailyProcessToCreateHistory
15+
@StartDate = @StartingDate,
16+
@EndDate = @StartingDate,
17+
@AverageNumberOfCustomerOrdersPerDay = @AverageNumberOfCustomerOrdersPerDay,
18+
@SaturdayPercentageOfNormalWorkDay = @SaturdayPercentageOfNormalWorkDay,
19+
@SundayPercentageOfNormalWorkDay = @SundayPercentageOfNormalWorkDay,
20+
@UpdateCustomFields = 0, -- they were done in the initial load
21+
@IsSilentMode = @IsSilentMode,
22+
@AreDatesPrinted = @AreDatesPrinted;
23+
24+
END;

samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/DataLoadSimulation/Stored Procedures/RecordDeliveryVanTemperatures.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ BEGIN
4040
SET @Latitude = 37.78352 + RAND() * 30;
4141
SET @Longitude = -122.4169 + RAND() * 40;
4242

43-
SET @IsCompressed = CASE WHEN @TimeCounter < '20160101' THEN 1 ELSE 0 END;
43+
SET @IsCompressed = CASE WHEN @TimeCounter < '20220101' THEN 1 ELSE 0 END;
4444

4545
SET @FullSensorData = N'{"Recordings": '
4646
+ N'['

0 commit comments

Comments
 (0)