IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_241]') AND type = 'U')
CREATE TABLE [dbo].[order_241]
(
    [ord_bchml] int NULL DEFAULT((0)),
    [ord_bcid] int NOT NULL DEFAULT((0)),
    [ord_bizid] int NOT NULL DEFAULT((0)),
    [ord_branch] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_cbid] bigint NOT NULL DEFAULT((0)),
    [ord_cmpid] int NOT NULL DEFAULT((0)),
    [ord_createbizids] nvarchar(200) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_createcuid] int NOT NULL DEFAULT((0)),
    [ord_createdepart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_createdpid] int NOT NULL DEFAULT((0)),
    [ord_creator] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_cuid] int NOT NULL DEFAULT((0)),
    [ord_date] datetime NOT NULL DEFAULT(getdate()),
    [ord_depart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_dpid] int NOT NULL DEFAULT((0)),
    [ord_empname] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_enddate] datetime NOT NULL DEFAULT('1900-1-1'),
    [ord_fbizid] int NOT NULL DEFAULT((0)),
    [ord_fbsm] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_finished] int NOT NULL DEFAULT((0)),
    [ord_fjbid] bigint NOT NULL DEFAULT((0)),
    [ord_ford2id] bigint NOT NULL DEFAULT((0)),
    [ord_ford2tag] int NOT NULL DEFAULT((0)),
    [ord_fordid] bigint NOT NULL DEFAULT((0)),
    [ord_ftype] varchar(10) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_groupkey] char(32) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_id] bigint NOT NULL IDENTITY(1, 1),
    [ord_key] varchar(30) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_no] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_noi] int NOT NULL DEFAULT((0)),
    [ord_rbizid] int NOT NULL DEFAULT((0)),
    [ord_rord2id] bigint NOT NULL DEFAULT((0)),
    [ord_rord2tag] int NOT NULL DEFAULT((0)),
    [ord_rordid] bigint NOT NULL DEFAULT((0)),
    [ord_rtype] varchar(10) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_security] int NOT NULL DEFAULT((3)),
    [ord_status] nvarchar(30) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_style] int NOT NULL DEFAULT((0)),
    [ord_template] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_templateid] int NOT NULL DEFAULT((0)),
    [ord_title] nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_type] nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [ord_updated] datetime NOT NULL DEFAULT(getdate()),
    [ord_hdsm_bak] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    [ord_yxhd_bak] nvarchar(8) COLLATE Chinese_PRC_CI_AS NULL,
    [ord_kzsl] int NOT NULL DEFAULT((0)),
    [ord_ext01] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext02] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext03] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext04] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext05] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext06] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext07] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext08] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext09] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext10] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext12] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext13] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext14] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext15] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext16] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext17] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext18] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext19] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext20] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_ext11] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_whlx] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT('允许拨打'),
    [ord_hmcount] int NULL DEFAULT((0)),
    [ord_hdlx] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_sobjid] bigint NULL DEFAULT((0)),
    [ord_hdmc] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_hdsm_bak_20181107164244047] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    [ord_yxhd_bak_20181107164244047] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    [ord_authority_factor] int NULL DEFAULT((0)),
    [ord_hdsm] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_yxhd] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [order_241_pk] PRIMARY KEY ([ord_id] ASC)
)

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

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

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

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

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

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