-- =============================================
-- Author:		Jas Rademeyer
-- Create date: 2017/02/27
-- Description:	Set all account items from previous months isLocked = true
-- =============================================
CREATE PROC sp_SetAccountsLock
AS

UPDATE	A
	SET	isLocked = 1
		,lockedDateTime = GETDATE()
--SELECT	*
FROM	pal_Account A
WHERE	A.dateOfCapture < CONVERT(varchar,dateadd(d,-(day(getdate()-1)),getdate()),106)
		AND A.isLocked = 0