/**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_STRUCTOFACCOUNT_S') 
 CREATE TABLE T_BCM_STRUCTOFACCOUNT_S (
FID BIGINT DEFAULT 0 NOT NULL,
FDATARESOURCE CHAR(1) DEFAULT '0' NOT NULL,
FACCTTABLEID BIGINT DEFAULT 0 NOT NULL,
FACCTFORMULA VARCHAR(255) DEFAULT ' ' NOT NULL
);


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_STOFACCOUNT_S_TABLE') CREATE INDEX IDX_BCM_STOFACCOUNT_S_TABLE ON T_BCM_STRUCTOFACCOUNT_S ( FACCTTABLEID );
 
  EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFACCOUNT_S', 'T_BCM_STRUCTOFACCOUNT_S', 'FID', '1';

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