@@ -23,39 +23,52 @@ BEGIN
2323 SELECT TOP 0 * INTO dbo .staging_test_table FROM dbo .test_table ;
2424
2525 INSERT INTO staging_test_table VALUES (1 , 2 , ' test' );
26- INSERT INTO expected_test_table VALUES (1 , 2 , ' test' );
26+ INSERT INTO expected_test_table VALUES (2 , 2 , ' test' );
2727 INSERT INTO watermark_test VALUES (' test_table' );
2828
2929 EXEC dbo .move_data_to_permanent_tables ' watermark_test' ;
3030
3131
32+ DECLARE @Expected AS VARCHAR (100 )
33+ DECLARE @Actual AS VARCHAR (100 )
34+
35+ SET @Expected = (SELECT COUNT (* ) FROM expected_test_table)
36+ SET @Actual = (SELECT COUNT (* ) FROM test_table)
3237 -- Validate test table has the same number of rows as expected table
3338 IF (SELECT COUNT (* ) FROM test_table) = (SELECT COUNT (* ) FROM expected_test_table)
34- RAISERROR (' Equal' , 0 , 1 ) WITH NOWAIT
35- ELSE
36- RAISERROR (' Not Equal' , 0 , 1 ) ;
39+ RAISERROR (' Expected and Actual Count is Equal' , 0 , 1 ) WITH NOWAIT ;
40+ ELSE
41+ RAISERROR (' Actual Value(%s) is not Equal to expected value (%s) ' , 0 , 1 , @Actual, @Expected) WITH NOWAIT ;
3742
3843 -- Validate test table has the same value for col1 as expected table
44+ SET @Expected = (SELECT col1 FROM expected_test_table)
45+ SET @Actual = (SELECT col1 FROM test_table)
3946 IF (SELECT col1 FROM test_table) = (SELECT col1 FROM expected_test_table)
40- RAISERROR (' Equal' , 0 , 1 ) WITH NOWAIT;
47+ RAISERROR (' Actual Col 1 is Equal to Expected Col 1 ' , 0 , 1 ) WITH NOWAIT ;
4148 ELSE
42- RAISERROR (' Not Equal' , 0 , 1 ) ;
49+ RAISERROR (' Actual Value(%s) is not Equal to expected value (%s) ' , 0 , 1 , @Actual, @Expected) WITH NOWAIT ;
4350
4451
4552 -- Validate test table has the same value for col2 as expected table
53+ SET @Expected = (SELECT col2 FROM expected_test_table)
54+ SET @Actual = (SELECT col2 FROM test_table)
4655 IF (SELECT col2 FROM test_table) = (SELECT col2 FROM expected_test_table)
47- RAISERROR (' Equal' , 0 , 1 ) WITH NOWAIT
56+ RAISERROR (' Actual Col 2 is Equal to Expected Col 2 ' , 0 , 1 ) WITH NOWAIT ;
4857 ELSE
49- RAISERROR (' Not Equal' , 0 , 1 ) ;
58+ RAISERROR (' Actual Value(%s) is not Equal to expected value (%s) ' , 0 , 1 , @Actual, @Expected) WITH NOWAIT ;
5059
5160 -- Validate test table has the same value for col3 as expected table
61+ SET @Expected = (SELECT col3 FROM expected_test_table)
62+ SET @Actual = (SELECT col3 FROM test_table)
5263 IF (SELECT col3 FROM test_table) = (SELECT col3 FROM expected_test_table)
53- RAISERROR (' Equal' , 0 , 1 ) WITH NOWAIT
64+ RAISERROR (' Actual Col 3 is Equal to Expected Col 3 ' , 0 , 1 ) WITH NOWAIT ;
5465 ELSE
55- RAISERROR (' Not Equal' , 0 , 1 ) ;
56-
66+ RAISERROR (' Actual Value(%s) is not Equal to expected value (%s) ' , 0 , 1 , @Actual, @Expected) WITH NOWAIT ;
67+
5768 DROP TABLE watermark_test;
5869 DROP TABLE test_table;
5970 DROP TABLE staging_test_table;
6071 DROP TABLE expected_test_table;
72+
73+
6174END
0 commit comments