DROP TABLE [dbo].[OM_SerialOrderStatusRecLst]
CREATE TABLE [dbo].[OM_SerialOrderStatusRecLst]
(
    [
    PlantNr]
    int
    NOT
    NULL, [
    SerialOrderId]
    nvarchar
(
    40
) NOT NULL ,
    [Pos] int NOT NULL ,
    [PrevStatus] int NOT NULL ,
    [Status] int NOT NULL ,
    [StartTime] datetime NULL ,
    [EndTime] datetime NULL ,
    [TriggerEvent] nvarchar
(
    40
) NOT NULL ,
    [TriggerObjectId] nvarchar
(
    40
) NOT NULL ,
    [TriggerSubObjectId] nvarchar
(
    40
) NOT NULL ,
    [OutputStatus] int NOT NULL ,
    [OutputEvent] nvarchar
(
    40
) NOT NULL ,
    [OutputEventMessageId] nvarchar
(
    40
) NOT NULL ,
    [OutputObjectId] nvarchar
(
    40
) NOT NULL ,
    [OutputSubObjectId] nvarchar
(
    40
) NOT NULL ,
    [Remark1] nvarchar
(
    100
) NOT NULL ,
    [Remark2] nvarchar
(
    100
) NOT NULL ,
    [LastModify] datetime NOT NULL ,
    [LastUser] nvarchar
(
    20
) NOT NULL ,
    [CreateTime] datetime NOT NULL
    )


ALTER TABLE [dbo].[OM_SerialOrderStatusRecLst] ADD PRIMARY KEY ([PlantNr], [SerialOrderId], [Pos])
