-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<cmpSqlResultsTest> | ||
<compare mode="KEY" diffTableSize="5" chunk="0" fileOutputOn="true" keyColumns="1,2"> | ||
<sql datasourceName="SQL_SERVER" filename="product.sql" keyTableName="AdventureWorks2008R2.dbo.TemplateKeyComparatorCheckAggregators" keyTableColumns="StoreNumber INTEGER not NULL, ProductID INTEGER not NULL" /> | ||
<beforeSqls> | ||
<sql datasourceName="SQL_SERVER" filename="drop.sql"/> | ||
<sql datasourceName="SQL_SERVER" filename="create.sql"/> | ||
<sql datasourceName="SQL_SERVER" filename="insert.sql"/> | ||
</beforeSqls> | ||
<file filename="product.csv" separator=";" startAtRow="2" ignoredColumns="1" threadColumn="1"> | ||
<transformers> | ||
<transformer column="2">REMOVE_LEADING_ZEROS</transformer> | ||
</transformers> | ||
<aggregators> | ||
<condition column="4" conditionValue="0">NOT_EQUALS</condition> | ||
<aggregator column="3" params="yyyy-MM-dd;gt">DATE</aggregator> | ||
<aggregator column="4">SUM_INTEGERS</aggregator> | ||
</aggregators> | ||
</file> | ||
</compare> | ||
</cmpSqlResultsTest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE [dbo].[TemplateKeyComparatorProducts]( | ||
[StoreNumber] [int] NOT NULL, | ||
[ProductID] [int] NULL, | ||
[Date] [date] NOT NULL, | ||
[Quantity] [int] NOT NULL) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
drop table [dbo].[TemplateKeyComparatorProducts] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
INSERT INTO [dbo].[TemplateKeyComparatorProducts] | ||
([StoreNumber] | ||
,[ProductID] | ||
,[Date] | ||
,[Quantity]) | ||
VALUES | ||
(11,123 ,'2020-09-09',300), | ||
(12,124 ,'2020-09-10',400) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TestSet;Store;Product;Date;Qty | ||
1;11;00123;2020-09-08;100 | ||
1;11;00123;2020-09-09;200 | ||
2;12;00124;2020-09-08;200 | ||
2;12;00124;2020-09-10;200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
SELECT | ||
pr.[StoreNumber] | ||
,pr.ProductID | ||
,pr.[Date] | ||
,sum(pr.[Quantity]) | ||
FROM [dbo].[TemplateKeyComparatorProducts] pr | ||
inner join AdventureWorks2008R2.dbo.TemplateKeyComparatorCheckAggregators d on d.[StoreNumber]=pr.[StoreNumber] and d.ProductID=pr.ProductID | ||
group by pr.[StoreNumber],pr.ProductID,pr.Date |