IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_bizflow]') AND type = 'U')
CREATE TABLE [dbo].[mps_bizflow]
(
    [flw_id] int NOT NULL IDENTITY(1, 1),
    [flw_bizid] int NULL DEFAULT((0)),
    [flw_title] nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [flw_scope] nvarchar(4000) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [flw_xml] text(16) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_MPS_BIZFLOW] PRIMARY KEY ([flw_id] ASC)
)

ALTER TABLE [dbo].[mps_bizflow] WITH CHECK ADD CONSTRAINT [FK_MPS_BIZF_MPS_BIZTY_MPS_BIZT] FOREIGN KEY ([flw_bizid]) REFERENCES [dbo].[mps_biztype] ([biz_id]) ON DELETE CASCADEALTER TABLE [dbo].[mps_bizflow] CHECK CONSTRAINT [FK_MPS_BIZF_MPS_BIZTY_MPS_BIZT]



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