DROP TABLE [dbo].[OM_WorkOrderStatus]
CREATE TABLE [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr]
    int
    NOT
    NULL, [
    WorkOrderId]
    nvarchar
(
    40
) NOT NULL ,
    [Status] int NOT NULL ,
    [TriggerEvent] nvarchar
(
    40
) NOT NULL ,
    [TriggerObjectId] nvarchar
(
    40
) NOT NULL ,
    [TriggerSubObjectId] nvarchar
(
    40
) NOT NULL ,
    [LastModify] datetime NOT NULL ,
    [LastUser] nvarchar
(
    20
) NOT NULL ,
    [CreateTime] datetime NOT NULL
    )
    IF
(
    (
    SELECT COUNT
(
    *
) from fn_listextendedproperty
(
    'MS_Description',
    'SCHEMA',
    N'dbo',
    'TABLE',
    N'OM_WorkOrderStatus',
    'COLUMN',
    N'Status'
)) > 0)
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'未上线  26'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderStatus'
    , @level2type = 'COLUMN', @level2name = N'Status'
    ELSE
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'未上线  26'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderStatus'
    , @level2type = 'COLUMN', @level2name = N'Status'
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000543',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:16.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000544',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:18.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000545',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:19.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000546',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:20.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000547',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:20.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000548',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:21.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000549',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:22.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000550',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:23.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000551',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:23.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000552',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:24.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000553',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:25.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000554',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:25.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000555',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:26.000'
)
    INSERT INTO [dbo].[OM_WorkOrderStatus]
(
    [
    PlantNr], [
    WorkOrderId], [
    Status], [
    TriggerEvent], [
    TriggerObjectId], [
    TriggerSubObjectId], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000556',
    N'24',
    N'',
    N'',
    N'',
    N'2021-05-08 09:52:31.000',
    N'admin',
    N'2021-05-06 17:19:28.000'
)


ALTER TABLE [dbo].[OM_WorkOrderStatus] ADD PRIMARY KEY ([PlantNr], [WorkOrderId])
