Test Scripts

Parameterized Tester Script
/*
     This script will execute a stored proc with parameterized Start/End Dates on a month-by-month basis and output results (if any) by each individual month.
     Verify that the stored proc being executed has DECLARED the Start/End Date parameters in the CREATE PROCEDURE line of code.  Ex. @StartDt/@EndDt or @StartDate/@EndDate, etc.
*/

DECLARE	@StartDate datetime, 
        @EndDate datetime
				
SET @StartDate = '01/01/2020'
 
WHILE(@Startdate < '01/01/2021')
BEGIN
	SET @EndDate = DATEADD(second, -1,DATEADD(month, 1, @Startdate))
	PRINT CAST(@Startdate AS char(20)) + ' ' +  CAST(@EndDate AS char(20))
	EXEC [dbo].[stored_proc_name] @StartDate, @EndDate
	SET @StartDate = DATEADD(month, 1, @Startdate)
END