/**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_ANALYSOLUCOLUMNDIM') 
 CREATE TABLE T_BCM_ANALYSOLUCOLUMNDIM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDIMID BIGINT DEFAULT 0 NOT NULL,
FMENBERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ANALYSOLUPAGEDIM') 
 CREATE TABLE T_BCM_ANALYSOLUPAGEDIM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDIMID BIGINT DEFAULT 0 NOT NULL,
FMENBERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ANALYSOLUROWDIM') 
 CREATE TABLE T_BCM_ANALYSOLUROWDIM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDIMID BIGINT DEFAULT 0 NOT NULL,
FMENBERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ANALYTICSSOLUTIONS') 
 CREATE TABLE T_BCM_ANALYTICSSOLUTIONS (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FSOLUTIONNUMBER VARCHAR(40) DEFAULT ' ' NOT NULL,
FSOLUTIONNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATEUSERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ANALYTICSSOLUTIONS_L') 
 CREATE TABLE T_BCM_ANALYTICSSOLUTIONS_L (
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHECKRECORD' AND KSQL_COL_NAME IN ('FBASECURRENCYID')) 
 ALTER TABLE T_BCM_CHECKRECORD ADD (FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL );

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