IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_247]') AND type = 'U')
CREATE TABLE [dbo].[order_247]
(
    [ord_bcid] int NULL DEFAULT((0)),
    [ord_bizid] int NULL DEFAULT((0)),
    [ord_branch] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_cbid] bigint NULL DEFAULT((0)),
    [ord_clhs1] decimal(18, 2) NULL DEFAULT((0)),
    [ord_clpj] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_clym] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_clzt] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_cmpid] int NULL DEFAULT((0)),
    [ord_createbizids] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_createcuid] int NULL DEFAULT((0)),
    [ord_createdepart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_createdpid] int NULL DEFAULT((0)),
    [ord_creator] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_cuid] int NULL DEFAULT((0)),
    [ord_date] datetime NULL DEFAULT(getdate()),
    [ord_depart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_dfqk] decimal(18, 2) NULL DEFAULT((0)),
    [ord_dpid] int NULL DEFAULT((0)),
    [ord_empname] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_enddate] datetime NULL DEFAULT('1900-1-1'),
    [ord_fbizid] int NULL DEFAULT((0)),
    [ord_fgcs] bigint NULL DEFAULT((0)),
    [ord_finished] int NULL DEFAULT((0)),
    [ord_fjbid] bigint NULL DEFAULT((0)),
    [ord_ford2id] bigint NULL DEFAULT((0)),
    [ord_ford2tag] int NULL DEFAULT((0)),
    [ord_fordid] bigint NULL DEFAULT((0)),
    [ord_ftype] varchar(10) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_groupkey] char(32) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_id] bigint NOT NULL IDENTITY(1, 1),
    [ord_jbrwtsj] datetime NULL DEFAULT('1900-1-1'),
    [ord_key] varchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_mxysj] decimal(18, 2) NULL DEFAULT((0)),
    [ord_no] varchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_noi] int NULL DEFAULT((0)),
    [ord_rbizid] int NULL DEFAULT((0)),
    [ord_rord2id] bigint NULL DEFAULT((0)),
    [ord_rord2tag] int NULL DEFAULT((0)),
    [ord_rordid] bigint NULL DEFAULT((0)),
    [ord_rtype] varchar(10) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_security] int NULL DEFAULT((3)),
    [ord_spzxcl] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT('否'),
    [ord_ssfgsidbcid] bigint NULL DEFAULT((0)),
    [ord_status] nvarchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_style] int NULL DEFAULT((0)),
    [ord_template] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_templateid] int NULL DEFAULT((0)),
    [ord_title] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_type] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_updated] datetime NULL DEFAULT(getdate()),
    [ord_whry] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_whwcsj] datetime NULL DEFAULT('1900-1-1'),
    [ord_wtry] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_wtzt] bigint NULL DEFAULT((0)),
    [ord_wxysj2] decimal(18, 2) NULL DEFAULT((0)),
    [ord_xqlx] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_xqms] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_zhmyd] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_zjgwtrsj] datetime NULL DEFAULT('1900-1-1'),
    [ord_abs] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_bgdate] datetime NULL DEFAULT('1900-1-1'),
    [ord_csr] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_engdate] datetime NULL DEFAULT('1900-1-1'),
    [ord_gwbh] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_jsdx] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_level] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_syrcuid] bigint NULL DEFAULT((0)),
    [ord_bmtr] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_nr3] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_nr4] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_sobjid] bigint NULL DEFAULT((0)),
    [ord_mdid] bigint NULL DEFAULT((0)),
    [ord_symddpid] bigint NULL DEFAULT((0)),
    [ord_xzmd] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_mdsyrid] bigint NULL DEFAULT((0)),
    [ord_zdmdsyrid] bigint NULL DEFAULT((0)),
    [ord_authority_factor] int NULL DEFAULT((0)),
    [ord_dqgssybmdpid] bigint NULL DEFAULT((0)),
    [ord_xzbm] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_bmmd] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL,
    [ord_nr1] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_nr2] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_jbexecutor] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_jbtitle] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_wrkid] int NULL DEFAULT((0)),
    [ord_zdgssybmdpid] bigint NULL DEFAULT((0)),
    [ord_jtzbjfgsbcid] bigint NULL DEFAULT((0)),
    [ord_xzfgs] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_zdgsmddpid] bigint NULL DEFAULT((0)),
    [ord_bmtrgw] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ord_mtrgw] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [order_247_pk] PRIMARY KEY ([ord_id] ASC)
)

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

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

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

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

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

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

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

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

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

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

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