IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_biztype_comefrom]') AND type = 'U')
CREATE TABLE [dbo].[mps_biztype_comefrom]
(
    [bs_id] int NOT NULL IDENTITY(1, 1),
    [bs_bizid] int NULL DEFAULT((0)),
    [bs_ord2tag] int NULL DEFAULT((0)),
    [bs_stype] varchar(10) COLLATE Chinese_PRC_CI_AS NULL DEFAULT('biz'),
    [bs_sbizid] int NULL DEFAULT((0)),
    [bs_sord2tag] int NULL DEFAULT((0)),
    [bs_sord2group] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_popwin] int NULL DEFAULT((0)),
    [bs_newviaord2] int NULL DEFAULT((1)),
    [bs_sql] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_scaption] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_scaption_detail] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_displayfield] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_orderfields] varchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_wintitle] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_width] varchar(20) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_js] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_prevsql] nvarchar(max) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_tables] nvarchar(1000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [bs_where] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_MPS_BIZTYPE_COMEFROM] PRIMARY KEY ([bs_id] ASC)
)

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

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

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

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