IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_report]') AND type = 'U')
CREATE TABLE [dbo].[mps_report]
(
    [rpt_id] int NOT NULL IDENTITY(1, 1),
    [rpt_cmpid] int NULL DEFAULT((0)),
    [rpt_title] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_category] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_categorysub] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_icon] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_interval] int NULL DEFAULT((0)),
    [rpt_order] varchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_note] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_identkey] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_tmpid] int NULL DEFAULT((0)),
    [rpt_template] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_labels] nvarchar(1000) COLLATE Chinese_PRC_CI_AS NULL,
    [rpt_labeloperation] nvarchar(1000) COLLATE Chinese_PRC_CI_AS NULL,
    [rpt_sql] varchar(max) COLLATE Chinese_PRC_CI_AS NULL,
    [rpt_url] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [rpt_accesscount] bigint NULL DEFAULT((0)),
    [rpt_hidemenu_mobile] int NULL DEFAULT((1)),
    [rpt_hidemenu] int NULL DEFAULT((1)),
    [rpt_widget] int NULL DEFAULT((1)),
    [rpt_icon0] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_mps_report] PRIMARY KEY ([rpt_id] ASC)
)


IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[mps_report]') AND name = 'mps_report_index')
CREATE NONCLUSTERED INDEX [mps_report_index] ON [dbo].[mps_report]([rpt_cmpid] ASC,[rpt_title] ASC)