CREATE TABLE [dbo].[PROD_Variant](
	[No] [int] IDENTITY(0,1) NOT NULL,
	[ProdNo_P] [nvarchar](32) NOT NULL,
	[RegDT] [datetime2](7) NOT NULL,
	[RegUser] [nvarchar](32) NOT NULL,
	[UpdateDT] [datetime2](7) NOT NULL,
	[UpdateUser] [nvarchar](32) NOT NULL,
	[GroupNo] [int] NULL,
	[Comment] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[TestListFileNo] [int] NULL,
	[UseTLPosition] [int] NOT NULL,
	[IsUse] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[No] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[PROD_Variant] ADD  DEFAULT (getdate()) FOR [RegDT]
GO

ALTER TABLE [dbo].[PROD_Variant] ADD  DEFAULT (getdate()) FOR [UpdateDT]
GO

ALTER TABLE [dbo].[PROD_Variant] ADD  DEFAULT ((0)) FOR [UseTLPosition]
GO

ALTER TABLE [dbo].[PROD_Variant] ADD  DEFAULT ((1)) FOR [IsUse]
GO

ALTER TABLE [dbo].[PROD_Variant]  WITH CHECK ADD FOREIGN KEY([GroupNo])
REFERENCES [dbo].[PROD_Group] ([No])
ON DELETE SET NULL
GO

ALTER TABLE [dbo].[PROD_Variant]  WITH CHECK ADD FOREIGN KEY([TestListFileNo])
REFERENCES [dbo].[STOR_TestListFile] ([No])
ON DELETE SET NULL
GO

ALTER TABLE [dbo].[PROD_Variant]  WITH CHECK ADD  CONSTRAINT [CK_PROD_TestList_UseTLPosition_2] CHECK  (([UseTLPosition]>=(0) AND [UseTLPosition]<=(10)))
GO

ALTER TABLE [dbo].[PROD_Variant] CHECK CONSTRAINT [CK_PROD_TestList_UseTLPosition_2]
GO


