IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_depart]') AND type = 'U')
CREATE TABLE [dbo].[mps_depart]
(
    [dp_id] int NOT NULL IDENTITY(1, 1),
    [dp_cmpid] int NULL DEFAULT((0)),
    [dp_bcid] int NULL DEFAULT((0)),
    [dp_code] varchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_innercode] varchar(20) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_depart] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_fullname] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_order] int NULL DEFAULT((999)),
    [dp_level] int NULL DEFAULT((0)),
    [dp_dpstdid] int NULL DEFAULT((0)),
    [dp_fdpid] int NULL DEFAULT((0)),
    [dp_ffdpid] int NULL DEFAULT((0)),
    [dp_foreign] int NULL DEFAULT((1)),
    [dp_display] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_hassub] int NULL DEFAULT((1)),
    [dp_salebudget] int NULL DEFAULT((1)),
    [dp_feebudget] int NULL DEFAULT((1)),
    [dp_phone] varchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_province] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_municipal] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_county] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_location] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_note] nvarchar(500) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_etnum] int NULL DEFAULT((0)),
    [dp_plnum] int NULL DEFAULT((0)),
    [dp_category1] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_category2] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_category3] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_longitude] decimal(18, 9) NULL DEFAULT((0)),
    [dp_latitude] decimal(18, 9) NULL DEFAULT((0)),
    [dp_opentime] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_news] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_status] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_key] varchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_isdepart] int NULL DEFAULT((0)),
    [dp_managearea] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_manager1] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid1] int NULL DEFAULT((0)),
    [dp_manager2] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid2] int NULL DEFAULT((0)),
    [dp_manager3] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid3] int NULL DEFAULT((0)),
    [dp_manager4] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid4] int NULL DEFAULT((0)),
    [dp_manager5] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid5] int NULL DEFAULT((0)),
    [dp_manager6] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid6] int NULL DEFAULT((0)),
    [dp_manager7] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid7] int NULL DEFAULT((0)),
    [dp_manager8] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid8] int NULL DEFAULT((0)),
    [dp_manager9] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid9] int NULL DEFAULT((0)),
    [dp_manager10] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_mcuid10] int NULL DEFAULT((0)),
    [dp_use] int NULL DEFAULT((0)),
    [dp_mcuid] int NULL DEFAULT((0)),
    [dp_manager] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_dingid] int NULL,
    [dp_dingbcid] int NULL,
    [dp_fffdpid] int NULL DEFAULT((0)),
    [dp_ext1] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [dp_ext2] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [dp_ext3] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [dp_ext4] varchar(max) COLLATE Chinese_PRC_CI_AS NOT NULL DEFAULT(''),
    [dp_num1] decimal(18, 2) NOT NULL DEFAULT((0)),
    [dp_num2] decimal(18, 2) NOT NULL DEFAULT((0)),
    [dp_num3] decimal(18, 2) NOT NULL DEFAULT((0)),
    [dp_type] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [dp_fromcc] int NULL DEFAULT((1)),
    [dp_loginscope] varchar(150) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_MPS_DEPART] PRIMARY KEY ([dp_id] ASC)
)