IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_240_1]') AND type = 'U')
CREATE TABLE [dbo].[order_240_1]
(
    [ord2_caption] nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_code] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_cuname] nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_date] datetime NOT NULL DEFAULT(getdate()),
    [ord2_fatherord2id] bigint NOT NULL DEFAULT((0)),
    [ord2_fbizid] int NOT NULL DEFAULT((0)),
    [ord2_ford2id] bigint NOT NULL DEFAULT((0)),
    [ord2_ford2tag] int NOT NULL DEFAULT((0)),
    [ord2_fordid] bigint NOT NULL DEFAULT((0)),
    [ord2_ftype] varchar(10) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_group] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_id] bigint NOT NULL IDENTITY(1, 1),
    [ord2_key] varchar(30) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_order] int NOT NULL DEFAULT((999)),
    [ord2_ordid] bigint NOT NULL DEFAULT((0)),
    [ord2_rbizid] int NOT NULL DEFAULT((0)),
    [ord2_rord2id] bigint NOT NULL DEFAULT((0)),
    [ord2_rord2tag] int NOT NULL DEFAULT((0)),
    [ord2_rordid] bigint NOT NULL DEFAULT((0)),
    [ord2_rtype] varchar(10) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_status] nvarchar(30) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_tag] int NOT NULL DEFAULT((0)),
    [ord2_tags] varchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord2_updated] datetime NOT NULL DEFAULT(getdate()),
    [ord2_jbid] bigint NULL DEFAULT((0)),
    [ord2_jbcrmid] bigint NULL DEFAULT((0)),
    [ord2_jbordid] bigint NULL DEFAULT((0)),
    [ord2_ordddzt] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_ordhm] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_ordkhxm] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_ordno] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_ordsfcj] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_ordstatus] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_ordwhzt] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord2_sfbg] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [order_240_1_pk] PRIMARY KEY ([ord2_id] ASC)
)

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[order_240_1]') AND name = 'index_order_240_1_ord2_ordid')
CREATE NONCLUSTERED INDEX [index_order_240_1_ord2_ordid] ON [dbo].[order_240_1]([ord2_ordid] ASC)

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[order_240_1]') AND name = 'index_order_240_1_ord2_tag')
CREATE NONCLUSTERED INDEX [index_order_240_1_ord2_tag] ON [dbo].[order_240_1]([ord2_tag] ASC)

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[order_240_1]') AND name = 'index_order_240_1_ord2_group')
CREATE NONCLUSTERED INDEX [index_order_240_1_ord2_group] ON [dbo].[order_240_1]([ord2_group] ASC)