IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_branch]') AND type = 'U')
CREATE TABLE [dbo].[mps_branch]
(
    [bc_id] int NOT NULL IDENTITY(1, 1),
    [bc_cmpid] int NULL DEFAULT((0)),
    [bc_code] varchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bc_incode] varchar(30) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bc_company] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bc_level] int NULL DEFAULT((0)),
    [bc_order] int NULL DEFAULT((0)),
    [bc_display] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bc_fullname] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bc_dingid] int NULL,
    [bc_fbcid] int NULL DEFAULT((0)),
    [bc_ffbcid] int NULL DEFAULT((0)),
    [bc_fffbcid] int NULL DEFAULT((0)),
    CONSTRAINT [PK_MPS_BRANCH] PRIMARY KEY ([bc_id] ASC)
)


IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[mps_branch]') AND name = 'mps_branch_index')
CREATE NONCLUSTERED INDEX [mps_branch_index] ON [dbo].[mps_branch]([bc_cmpid] ASC,[bc_code] ASC)