IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_equctg]') AND type = 'U')
CREATE TABLE [dbo].[mps_equctg]
(
    [ec_id] int NOT NULL IDENTITY(1, 1),
    [ec_cmpid] int NULL DEFAULT((0)),
    [ec_tag] int NULL DEFAULT((0)),
    [ec_caption] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_type] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_father] int NULL DEFAULT((0)),
    [ec_full] nvarchar(500) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_keys] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_code] varchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_level] int NULL DEFAULT((0)),
    [ec_order] int NULL DEFAULT((999)),
    [ec_share] int NULL DEFAULT((1)),
    [ec_querytime] int NULL DEFAULT((0)),
    [ec_groupfields] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_status] int NULL DEFAULT((1)),
    [ec_security] int NULL DEFAULT((0)),
    [ec_changed] int NULL,
    [ec_icon] varchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_database] varchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_bmcode] varchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_searchfields] varchar(2000) COLLATE Chinese_PRC_CI_AS NULL,
    [ec_selectfuncs] nvarchar(500) COLLATE Chinese_PRC_CI_AS NULL,
    [ec_selectstyle] int NULL DEFAULT((0)),
    [ec_funcs] varchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_flows] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_params] varchar(500) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_viewscope] int NULL DEFAULT((0)),
    [ec_views] int NULL DEFAULT((0)),
    [ec_select] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_from] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_where] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [ec_orderby] nvarchar(2000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_MPS_EQUCTG] PRIMARY KEY ([ec_id] ASC)
)