DROP TABLE [dbo].[OM_WorkOrderQty]
CREATE TABLE [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr]
    int
    NOT
    NULL, [
    WorkOrderId]
    nvarchar
(
    40
) NOT NULL ,
    [PlanQty] float
(
    53
) NOT NULL ,
    [ReleasedQty] float
(
    53
) NOT NULL ,
    [ActQty] float
(
    53
) NOT NULL ,
    [ActGoodQty] float
(
    53
) NOT NULL ,
    [ActScrapQty] float
(
    53
) NOT NULL ,
    [ActReworkQty] float
(
    53
) NOT NULL ,
    [ActQty1] float
(
    53
) NOT NULL ,
    [ActQty2] float
(
    53
) NOT NULL ,
    [ActQty3] float
(
    53
) NOT NULL ,
    [ActQty4] float
(
    53
) 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_WorkOrderQty',
    'COLUMN',
    N'PlanQty'
)) > 0)
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'yao'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'PlanQty'
    ELSE
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'yao'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'PlanQty'
    IF
(
    (
    SELECT COUNT
(
    *
) from fn_listextendedproperty
(
    'MS_Description',
    'SCHEMA',
    N'dbo',
    'TABLE',
    N'OM_WorkOrderQty',
    'COLUMN',
    N'ReleasedQty'
)) > 0)
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'同planqty'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'ReleasedQty'
    ELSE
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'同planqty'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'ReleasedQty'
    IF
(
    (
    SELECT COUNT
(
    *
) from fn_listextendedproperty
(
    'MS_Description',
    'SCHEMA',
    N'dbo',
    'TABLE',
    N'OM_WorkOrderQty',
    'COLUMN',
    N'ActQty'
)) > 0)
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'下线数量 80'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'ActQty'
    ELSE
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'下线数量 80'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'ActQty'
    IF
(
    (
    SELECT COUNT
(
    *
) from fn_listextendedproperty
(
    'MS_Description',
    'SCHEMA',
    N'dbo',
    'TABLE',
    N'OM_WorkOrderQty',
    'COLUMN',
    N'ActQty1'
)) > 0)
    EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'线上生产中数量 40'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'ActQty1'
    ELSE
    EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'线上生产中数量 40'
    , @level0type = 'SCHEMA', @level0name = N'dbo'
    , @level1type = 'TABLE', @level1name = N'OM_WorkOrderQty'
    , @level2type = 'COLUMN', @level2name = N'ActQty1'
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000543',
    N'18',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-08 09:42:38.000',
    N'task',
    N'2021-05-06 17:19:16.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000544',
    N'13',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:28.000',
    N'crontab',
    N'2021-05-06 17:19:18.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000545',
    N'1',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:19:19.000',
    N'crontab',
    N'2021-05-06 17:19:19.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000546',
    N'21',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:30.000',
    N'crontab',
    N'2021-05-06 17:19:20.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000547',
    N'19',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:32.000',
    N'crontab',
    N'2021-05-06 17:19:20.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000548',
    N'15',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:35.000',
    N'crontab',
    N'2021-05-06 17:19:21.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000549',
    N'15',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:37.000',
    N'crontab',
    N'2021-05-06 17:19:22.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000550',
    N'1',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:19:23.000',
    N'crontab',
    N'2021-05-06 17:19:23.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000551',
    N'2',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:39.000',
    N'crontab',
    N'2021-05-06 17:19:23.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000552',
    N'16',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:39.000',
    N'crontab',
    N'2021-05-06 17:19:24.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000553',
    N'3',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:40.000',
    N'crontab',
    N'2021-05-06 17:19:25.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000554',
    N'12',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:40.000',
    N'crontab',
    N'2021-05-06 17:19:25.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000555',
    N'16',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:41.000',
    N'crontab',
    N'2021-05-06 17:19:26.000'
)
    INSERT INTO [dbo].[OM_WorkOrderQty]
(
    [
    PlantNr], [
    WorkOrderId], [
    PlanQty], [
    ReleasedQty], [
    ActQty], [
    ActGoodQty], [
    ActScrapQty], [
    ActReworkQty], [
    ActQty1], [
    ActQty2], [
    ActQty3], [
    ActQty4], [
    LastModify], [
    LastUser],
[
    CreateTime]
) VALUES
(
    N'100',
    N'WO-00000556',
    N'36',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'0',
    N'2021-05-06 17:20:41.000',
    N'crontab',
    N'2021-05-06 17:19:28.000'
)


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