IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_attach_log]') AND type = 'U')
CREATE TABLE [dbo].[mps_attach_log]
(
    [du_id] bigint NOT NULL IDENTITY(1, 1),
    [du_daid] bigint NULL DEFAULT((0)),
    [du_date] datetime NULL DEFAULT(getdate()),
    [du_bcid] int NULL DEFAULT((0)),
    [du_branch] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [du_dpid] int NULL DEFAULT((0)),
    [du_depart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [du_cuid] int NULL DEFAULT((0)),
    [du_cuname] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [du_lastdate] datetime NULL DEFAULT(getdate()),
    [du_count] int NULL DEFAULT((0)),
    [du_operation] int NULL DEFAULT((0)),
    CONSTRAINT [PK_mps_attach_log] PRIMARY KEY ([du_id] ASC)
)


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