/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISFORMULASETTING') 
 CREATE TABLE T_BCM_ISFORMULASETTING (
FID BIGINT DEFAULT 0 NOT NULL,
FINCLUDEPOSTED CHAR(1) DEFAULT '0' NOT NULL,
FINCLUDELEAF CHAR(1) DEFAULT '0' NOT NULL,
FINCLUDELEAFACCOUNT CHAR(1) DEFAULT '0' NOT NULL,
FINCLUDESUB CHAR(1) DEFAULT '0' NOT NULL,
FINCLUDESUBACCOUNT CHAR(1) DEFAULT '0' NOT NULL,
FINCLUDEALLASSISTITEMS CHAR(1) DEFAULT '0' NOT NULL,
FSCHEME BIGINT DEFAULT 0 NOT NULL
);

 EXEC P_ALTERPK 'PK_T_BCM_ISFORMULASETTING', 'T_BCM_ISFORMULASETTING', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_ISFORMULASETTING') CREATE INDEX IDX_BCM_ISFORMULASETTING ON T_BCM_ISFORMULASETTING ( FSCHEME );
