/*
   دوشنبه,  2 بهمن 1402 13:09 ب.ظ
   User: 
   Server: TAHERIAN
   Database: ATNDB
   Application: 
*/

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
BEGIN TRANSACTION
GO
--Select * from UserActionLog
--Where Left(SystemsOperationRef,4) = '4020'

/*
If Exists(Select * From INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS Where CONSTRAINT_NAME ='FK_UserActionLog_SystemsOperation')
Begin
	ALTER TABLE [dbo].[UserActionLog] DROP CONSTRAINT [FK_UserActionLog_SystemsOperation]
	Print 'Constraint Deleted'
End

Update 
	UserActionLog
Set
	SystemsOperationRef = '4051' + Substring(SystemsOperationRef, 5, Len(SystemsOperationRef) - 4)
Where
	Left(SystemsOperationRef,4) = '4020'
*/

--Select * from UserActionLog
--Where Left(SystemsOperationRef,4) = '4051'

Delete 
	UserActionLog
Where
	Left(SystemsOperationRef,2) = '40'

Go
COMMIT





