/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
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.AccChequeReceiptItem
	DROP CONSTRAINT DF_AccChequeReceiptItem_UpdateDate
GO
ALTER TABLE dbo.AccChequeReceiptItem
	DROP CONSTRAINT DF_AccChequeReceiptItem_Updater
GO
ALTER TABLE dbo.AccChequeReceiptItem
	DROP CONSTRAINT DF_Table_1_UpdateDate1_1
GO
ALTER TABLE dbo.AccChequeReceiptItem
	DROP CONSTRAINT DF_Table_1_Updater1_1
GO
CREATE TABLE dbo.Tmp_AccChequeReceiptItem
	(
	ID bigint NOT NULL IDENTITY (1, 1),
	ReceiptID bigint NOT NULL,
	ChequeNo nvarchar(20) NOT NULL,
	AccountNo nvarchar(30) NOT NULL,
	BankName nvarchar(100) NOT NULL,
	BankBranch nvarchar(100) NOT NULL,
	ChequeDate datetime NOT NULL,
	ChequeValue decimal(28, 5) NOT NULL,
	UpdateDate datetime NOT NULL,
	Updater bigint NOT NULL,
	InsertDate datetime NOT NULL,
	Inserter bigint NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_AccChequeReceiptItem ADD CONSTRAINT
	DF_AccChequeReceiptItem_UpdateDate DEFAULT (getdate()) FOR UpdateDate
GO
ALTER TABLE dbo.Tmp_AccChequeReceiptItem ADD CONSTRAINT
	DF_AccChequeReceiptItem_Updater DEFAULT ((0)) FOR Updater
GO
ALTER TABLE dbo.Tmp_AccChequeReceiptItem ADD CONSTRAINT
	DF_Table_1_UpdateDate1_1 DEFAULT (getdate()) FOR InsertDate
GO
ALTER TABLE dbo.Tmp_AccChequeReceiptItem ADD CONSTRAINT
	DF_Table_1_Updater1_1 DEFAULT ((0)) FOR Inserter
GO
SET IDENTITY_INSERT dbo.Tmp_AccChequeReceiptItem ON
GO
IF EXISTS(SELECT * FROM dbo.AccChequeReceiptItem)
	 EXEC('INSERT INTO dbo.Tmp_AccChequeReceiptItem (ID, ReceiptID, ChequeNo, AccountNo, BankName, BankBranch, ChequeDate, ChequeValue, UpdateDate, Updater, InsertDate, Inserter)
		SELECT ID, ReceiptID, ChequeNo, AccountNo, BankName, BankBranch, ChequeDate, ChequeValue, UpdateDate, Updater, InsertDate, Inserter FROM dbo.AccChequeReceiptItem WITH (HOLDLOCK TABLOCKX)')
GO
SET IDENTITY_INSERT dbo.Tmp_AccChequeReceiptItem OFF
GO
DROP TABLE dbo.AccChequeReceiptItem
GO
EXECUTE sp_rename N'dbo.Tmp_AccChequeReceiptItem', N'AccChequeReceiptItem', 'OBJECT' 
GO
ALTER TABLE dbo.AccChequeReceiptItem ADD CONSTRAINT
	PK_AccChequeReceiptItem PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
COMMIT
