/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZRULEDIMFILTER') 
 CREATE TABLE T_EB_BIZRULEDIMFILTER (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FDATASETID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_BIZRULEDIMFILTER_P1') CREATE INDEX IDX_EB_BIZRULEDIMFILTER_P1 ON T_EB_BIZRULEDIMFILTER ( FMODELID ,FDATASETID);

 EXEC P_ALTERPK 'PK_EB_BIZRULEDIMFILTER', 'T_EB_BIZRULEDIMFILTER', 'FID', '1';


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZRULEDIMFILTER_CON') 
 CREATE TABLE T_EB_BIZRULEDIMFILTER_CON (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDIMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMMEMBER NCLOB
);

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_BIZRULEDIMFILTER_CON_P1') CREATE INDEX IDX_EB_BIZRULEDIMFILTER_CON_P1 ON T_EB_BIZRULEDIMFILTER_CON ( FID );

 EXEC P_ALTERPK 'PK_EB_BIZRULEDIMFILTER_CON', 'T_EB_BIZRULEDIMFILTER_CON', 'FENTRYID', '1';



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZRULEDIMFILTER_RB') 
 CREATE TABLE T_EB_BIZRULEDIMFILTER_RB (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL
);

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_BIZRULEDIMFILTER_RB_P1') CREATE INDEX IDX_EB_BIZRULEDIMFILTER_RB_P1 ON T_EB_BIZRULEDIMFILTER_RB ( FID,FACCOUNTID );

 EXEC P_ALTERPK 'PK_EB_BIZRULEDIMFILTER_RB', 'T_EB_BIZRULEDIMFILTER_RB', 'FPKID', '1';


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
