Skip to content

Commit

Permalink
rolling back to last known good state
Browse files Browse the repository at this point in the history
  • Loading branch information
jodebrui committed Sep 13, 2016
1 parent 51b0124 commit f99d932
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 111 deletions.
Expand Up @@ -2926,9 +2926,7 @@ CREATE PROCEDURE DataLoadSimulation.DailyProcessToCreateHistory
@SundayPercentageOfNormalWorkDay int,
@UpdateCustomFields bit,
@IsSilentMode bit,
@AreDatesPrinted bit,
-- @CommitBatchSize, the size of each commit batch, added by Shiyang Qiu, July 14, 2016
@CommitBatchSize int = 10
@AreDatesPrinted bit
AS
BEGIN
SET NOCOUNT ON;
Expand All @@ -2943,18 +2941,13 @@ BEGIN
DECLARE @IsMonday bit;
DECLARE @Weekday int;
DECLARE @IsStaffOnly bit;
-- @TotalNumberCounter, used to count the number of record, added by Shiyang Qiu, July 14, 2016
DECLARE @TotalNumberCounter int = 1;
SET DATEFIRST 7; -- Week begins on Sunday
EXEC DataLoadSimulation.DeactivateTemporalTablesBeforeDataLoad;
WHILE @CurrentDateTime <= @EndDate
BEGIN
--begin tran if there is no transaction
IF(@@TRANCOUNT=0) BEGIN TRAN
IF @AreDatesPrinted <> 0 OR @IsSilentMode = 0
BEGIN
PRINT SUBSTRING(DATENAME(weekday, @CurrentDateTime), 1,3) + N'' '' + CONVERT(nvarchar(20), @CurrentDateTime, 107);
Expand Down Expand Up @@ -3095,17 +3088,7 @@ BEGIN
PRINT N'' '';
END;
--control the batch commit
--where there is tran, and (meet the commit size or the final record)
IF(@@TRANCOUNT=1 and ((@TotalNumberCounter % @CommitBatchSize = 0) or @CurrentDateTime = @EndDate))
BEGIN
IF @AreDatesPrinted <> 0 OR @IsSilentMode = 0 print ''COMMIT''
COMMIT
END
-- increase the @CurrentDateTime and the @TotalNumberCounter
SET @CurrentDateTime = DATEADD(day, 1, @CurrentDateTime);
SET @TotalNumberCounter = @TotalNumberCounter + 1;
SET @CurrentDateTime = DATEADD(day, 1, @CurrentDateTime);
END; -- of processing each day
IF @UpdateCustomFields <> 0
Expand Down Expand Up @@ -6202,4 +6185,4 @@ EXEC DataLoadSimulation.PopulateDataToCurrentDate
@IsSilentMode = 1,
@AreDatesPrinted = 1;
*/
*/

0 comments on commit f99d932

Please sign in to comment.