﻿CREATE TABLE [dbo].[WorkOrderStep_Hist]
(
	[WorkOrderNumber] BIGINT NOT NULL, 
    [WorkCenterCode] VARCHAR(12) NOT NULL, 
	[StepNumber] DECIMAL(7, 2) NOT NULL, 
	[StepTypeCode] VARCHAR(2) NOT NULL,
    [BranchCode] VARCHAR(12) NOT NULL, 
	[StepDescription] VARCHAR(30) NULL,
    [StartDT] DATETIME NULL, 
    [EndDT] DATETIME NULL, 
	[FunctionCode] VARCHAR(15) NULL,
	[ScrappedQuantity] DECIMAL(18, 2) NOT NULL,
    [LastUpdateDT] DATETIME NOT NULL,
	CONSTRAINT [PK_WorkOrderStep_Hist] PRIMARY KEY CLUSTERED([WorkOrderNumber], [WorkCenterCode], [StepNumber], [StepTypeCode])
)

GO

CREATE INDEX [IX_WorkOrderStep_Hist_WorkCenterCode] ON [dbo].[WorkOrderStep_Hist] ([WorkCenterCode]) INCLUDE([WorkOrderNumber])

GO