IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_warehouse]') AND type = 'U')
CREATE TABLE [dbo].[mps_warehouse]
(
    [wh_id] int NOT NULL IDENTITY(1, 1),
    [wh_code] varchar(20) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [wh_caption] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [wh_cmpid] int NULL DEFAULT((0)),
    [wh_bcid] int NULL DEFAULT((0)),
    [wh_dpid] int NULL DEFAULT((0)),
    [wh_location] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [wh_longitude] decimal(18, 10) NULL DEFAULT((0)),
    [wh_latitude] decimal(18, 10) NULL DEFAULT((0)),
    [wh_outstyle] int NULL DEFAULT((0)),
    [wh_feestyle] int NULL DEFAULT((0)),
    [wh_display] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [wh_fullname] nvarchar(500) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_mps_warehouse] PRIMARY KEY ([wh_id] ASC)
)

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