From bad15904b17224c0965e35f996dca9c61bc5ef7d Mon Sep 17 00:00:00 2001 From: Jos de Bruijn Date: Mon, 26 Jun 2017 08:49:56 -0700 Subject: [PATCH] replacing inner join to BuyingGroups with LEFT JOIN Fixing logical error in the integration proc. Not all customers are in buying groups. --- .gitignore | 3 +++ .../Stored Procedures/GetCustomerUpdates.sql | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index ac7d5f73..e38e42a7 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,6 @@ samples/applications/iot-smart-grid/Db/obj/Release/Db.sqlproj.FileListAbsolute.t *.manifest samples/applications/iot-smart-grid/WinFormsClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs samples/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/obj/Development/IncrementalShapshot.xml +samples/applications/iot-smart-grid/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix +samples/applications/iot-smart-grid/Db/obj/Release/Model.xml +samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Release/MultithreadedOrderInsert.csproj.FileListAbsolute.txt diff --git a/samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/Integration/Stored Procedures/GetCustomerUpdates.sql b/samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/Integration/Stored Procedures/GetCustomerUpdates.sql index 466c3687..61efe55b 100644 --- a/samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/Integration/Stored Procedures/GetCustomerUpdates.sql +++ b/samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/Integration/Stored Procedures/GetCustomerUpdates.sql @@ -61,14 +61,14 @@ BEGIN bg.BuyingGroupName, p.FullName, c.DeliveryPostalCode, c.ValidFrom, c.ValidTo FROM Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS c - INNER JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg - ON c.BuyingGroupID = bg.BuyingGroupID INNER JOIN Sales.CustomerCategories FOR SYSTEM_TIME AS OF @ValidFrom AS cc ON c.CustomerCategoryID = cc.CustomerCategoryID INNER JOIN Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS bt ON c.BillToCustomerID = bt.CustomerID INNER JOIN [Application].People FOR SYSTEM_TIME AS OF @ValidFrom AS p ON c.PrimaryContactPersonID = p.PersonID + LEFT JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg + ON c.BuyingGroupID = bg.BuyingGroupID WHERE c.BuyingGroupID = @BuyingGroupID; FETCH NEXT FROM BuyingGroupChangeList INTO @BuyingGroupID, @ValidFrom; @@ -109,14 +109,14 @@ BEGIN bg.BuyingGroupName, p.FullName, c.DeliveryPostalCode, c.ValidFrom, c.ValidTo FROM Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS c - INNER JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg - ON c.BuyingGroupID = bg.BuyingGroupID INNER JOIN Sales.CustomerCategories FOR SYSTEM_TIME AS OF @ValidFrom AS cc ON c.CustomerCategoryID = cc.CustomerCategoryID INNER JOIN Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS bt ON c.BillToCustomerID = bt.CustomerID INNER JOIN [Application].People FOR SYSTEM_TIME AS OF @ValidFrom AS p ON c.PrimaryContactPersonID = p.PersonID + LEFT JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg + ON c.BuyingGroupID = bg.BuyingGroupID WHERE cc.CustomerCategoryID = @CustomerCategoryID; FETCH NEXT FROM CustomerCategoryChangeList INTO @CustomerCategoryID, @ValidFrom; @@ -155,14 +155,14 @@ BEGIN bg.BuyingGroupName, p.FullName, c.DeliveryPostalCode, c.ValidFrom, c.ValidTo FROM Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS c - INNER JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg - ON c.BuyingGroupID = bg.BuyingGroupID INNER JOIN Sales.CustomerCategories FOR SYSTEM_TIME AS OF @ValidFrom AS cc ON c.CustomerCategoryID = cc.CustomerCategoryID INNER JOIN Sales.Customers FOR SYSTEM_TIME AS OF @ValidFrom AS bt ON c.BillToCustomerID = bt.CustomerID INNER JOIN [Application].People FOR SYSTEM_TIME AS OF @ValidFrom AS p ON c.PrimaryContactPersonID = p.PersonID + LEFT JOIN Sales.BuyingGroups FOR SYSTEM_TIME AS OF @ValidFrom AS bg + ON c.BuyingGroupID = bg.BuyingGroupID WHERE c.CustomerID = @CustomerID; FETCH NEXT FROM CustomerChangeList INTO @CustomerID, @ValidFrom;