/*
   یکشنبه, 31 خرداد 1405 - 17:03: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
--------------------------------------------------------------
Create Table dbo.SizeGroup(
	Serial Bigint Identity(1,1) Not Null,
	Code int Null,
	FADes Varchar(300) Null,
	ENDes Varchar(300) Null,
	RecorderRef Int Null,
	RecordDate char(10) Null,
	EditorRef Int Null,
	EditDate char(10) Null,
	OfficeDetailRef Int Null,
	Tag Varchar(50) Null)
Go
Alter Table dbo.SizeGroup Add Constraint PK_SizeGroup Primary Key Clustered (Serial)
Go
--------------------------------------------------------------
Create Table dbo.Size(
	Serial Bigint Identity(1,1) Not Null,
	SizeGroupRef Bigint Not Null,
	Code int Null,
	FADes Varchar(300) Null,
	ENDes Varchar(300) Null,
	RecorderRef Int Null,
	RecordDate char(10) Null,
	EditorRef Int Null,
	EditDate char(10) Null,
	OfficeDetailRef Int Null,
	Tag Varchar(50) Null)
Go
Alter Table dbo.Size Add Constraint PK_Size Primary Key Clustered (Serial)
Go
--------------------------------------------------------------
Create Table dbo.Color(
	Serial Bigint Identity(1,1) Not Null,
	Code int Null,
	FADes Varchar(300) Null,
	ENDes Varchar(300) Null,
	RecorderRef Int Null,
	RecordDate char(10) Null,
	EditorRef Int Null,
	EditDate char(10) Null,
	OfficeDetailRef Int Null,
	Tag Varchar(50) Null)
Go
Alter Table dbo.Color Add Constraint PK_Color Primary Key Clustered (Serial)
Go
--------------------------------------------------------------
ALTER TABLE dbo.Part ADD
	ColorRef Varchar(MAX) Null,
	SizeGroupRef Bigint Null,
	SizeRef Varchar(MAX) Null
GO
ALTER TABLE dbo.Part SET (LOCK_ESCALATION = TABLE)
GO
--------------------------------------------------------------
COMMIT