/*
   چهار شنبه, 18 مرداد 1402 12:00:00 ب.ظ
   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
ALTER TABLE dbo.GetterOrPayerFactor ADD
	GetterOrPayerFactorPatternRef smallint NULL
GO
ALTER TABLE dbo.GetterOrPayerFactor SET (LOCK_ESCALATION = TABLE)
GO
COMMIT


Update 
	GetterOrPayerFactor 
Set 
	GetterOrPayerFactorPatternRef = Case When GetterOrPayerFactorTypeRef = 1 Then 1
										 When GetterOrPayerFactorTypeRef = 4 Then 8
										 Else Null End
Where
	GetterOrPayerFactor.KindRef = 2


/*
-- چون جدول الگوها هنوز در دیتابیس ایجاد نشده کویری زیر قابل استفاده نیست
Update 
	GetterOrPayerFactor 
Set 
	GetterOrPayerFactorPatternRef = GetterOrPayerFactorPattern.Serial
From
	GetterOrPayerFactor Inner Join
	GetterOrPayerFactorPattern On GetterOrPayerFactorPattern.PatternType = GetterOrPayerFactor.GetterOrPayerFactorTypeRef
Where
	GetterOrPayerFactor.KindRef = 2
*/