IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_task]') AND type = 'U')
CREATE TABLE [dbo].[mps_task]
(
    [tsk_id] int NOT NULL IDENTITY(1, 1),
    [tsk_cmpid] int NULL DEFAULT((0)),
    [tsk_bcid] int NULL DEFAULT((0)),
    [tsk_branch] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [tsk_dpid] int NULL DEFAULT((0)),
    [tsk_depart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [tsk_cuid] int NULL DEFAULT((0)),
    [tsk_cuname] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [tsk_date] datetime NULL DEFAULT(getdate()),
    [tsk_objtype] varchar(20) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [tsk_ctgid] int NULL DEFAULT((0)),
    [tsk_objid2] bigint NULL DEFAULT((0)),
    [tsk_objid] bigint NULL DEFAULT((0)),
    [tsk_message] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [tsk_type] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [tsk_jbid] bigint NULL DEFAULT((0)),
    CONSTRAINT [PK_mps_task] PRIMARY KEY ([tsk_id] ASC)
)


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