Use ATNDBTest
Go

BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
If Exists(Select * From sys.objects Where name = 'FK_UserActionLog_SystemsOperation') 
	ALTER TABLE dbo.UserActionLog
		DROP CONSTRAINT FK_UserActionLog_SystemsOperation
	GO
	ALTER TABLE dbo.SystemsOperation SET (LOCK_ESCALATION = TABLE)
	GO

ALTER TABLE dbo.UserActionLog SET (LOCK_ESCALATION = TABLE)
GO

Update UserActionLog set SystemsOperationRef = '0210'   Where SystemsOperationRef = '0205'
Update UserActionLog set SystemsOperationRef = '021001' Where SystemsOperationRef = '020501'
Update UserActionLog set SystemsOperationRef = '021002' Where SystemsOperationRef = '020502'
Update UserActionLog set SystemsOperationRef = '021003' Where SystemsOperationRef = '020503'
Update UserActionLog set SystemsOperationRef = '0220'   Where SystemsOperationRef = '0206'
Update UserActionLog set SystemsOperationRef = '022001' Where SystemsOperationRef = '020601'
Update UserActionLog set SystemsOperationRef = '022002' Where SystemsOperationRef = '020602'
Update UserActionLog set SystemsOperationRef = '022003' Where SystemsOperationRef = '020603'
Update UserActionLog set SystemsOperationRef = '022004' Where SystemsOperationRef = '020604'
Update UserActionLog set SystemsOperationRef = '022010' Where SystemsOperationRef = '020605'
