/**Begin D:\PDM_UPGRADE\PDM1\BCM_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ANNUALACCOUNT' AND KSQL_COL_NAME IN ('FISOPEN')) 
 ALTER TABLE T_BCM_ANNUALACCOUNT ADD (FISOPEN CHAR(1) DEFAULT '1' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_UNIONPERMTREE') 
 CREATE TABLE T_BCM_UNIONPERMTREE (
FID BIGINT DEFAULT 0 NOT NULL,
FPERMITEMID VARCHAR(30) DEFAULT ' ' NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNODENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FAPPNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_UNIONPERMTREE_L') 
 CREATE TABLE T_BCM_UNIONPERMTREE_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNODENAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_AUTH_DATAENTRY') 
 CREATE TABLE T_BCM_AUTH_DATAENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FUNIONPERMID BIGINT DEFAULT 0 NOT NULL,
FISCHECK CHAR(1) DEFAULT '0' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\BCM_table.sql **/
