Page 1 of 1

SPR_StudentRegisterUpdateTaskReset

Posted: Fri Mar 03, 2017 12:05 am
by robinwilson16
Used in conjunction with the Student Register Update task schedule on the server to flood fill tilde and W marks. The stored procedure resets any registers that failed to update so they will be processed the next time the task runs

Code: Select all

CREATE PROCEDURE [dbo].[SPR_StudentRegisterUpdateTaskReset]
AS

BEGIN
	SET NOCOUNT ON;

	UPDATE ST
	SET
		ST.st_end = NULL,
		ST.st_status = NULL,
		ST.st_errormessage = NULL
	FROM ulive.dbo.caps_systemtask ST
	INNER JOIN ulive.dbo.capd_moduleenrolment MEG
		ON MEG.e_id = ST.st_object
	INNER JOIN ulive.dbo.capd_module GRP
		ON GRP.m_id = MEG.e_module
	INNER JOIN ulive.dbo.capd_session SES
		ON CAST ( SES.s_start AS DATE ) <= CAST ( GETDATE() AS DATE )
		AND CAST ( SES.s_end AS DATE ) >= CAST ( GETDATE() AS DATE )
	WHERE
		GRP.m_type = 'G'
		AND GRP.m_start <= LEFT ( SES.s_name, 2 ) + RIGHT ( SES.s_name, 2 ) + '-07-31'
		AND GRP.m_end >= LEFT ( SES.s_name, 4 ) + '-08-01'​​
		AND ST.st_type = 'attenrol'
		AND ST.st_status = 'failed'
END