/*
   سه شنبه, 18 اردیبهشت 1403 - 10:10:22 ق.ظ
   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.FactorHeader ADD
	PaymentMethod smallint NULL,
	PayDay int NULL
GO
ALTER TABLE dbo.FactorHeader SET (LOCK_ESCALATION = TABLE)
GO


Update 
	FactorHeader
Set
	PayDay = IsNull(dbo.DiffDate(EffectiveDate, PayDate),0),
	PaymentMethod = 1


COMMIT