/**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_CHKATTACHMENT') 
 CREATE TABLE T_BCM_CHKATTACHMENT (
FID BIGINT DEFAULT 0 NOT NULL,
FSUBFOLDER VARCHAR(255) DEFAULT ' ' NOT NULL,
FNODEINFOID BIGINT DEFAULT 0 NOT NULL,
FATTTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FREPORTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_CHKNOTE') 
 CREATE TABLE T_BCM_CHKNOTE (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FTYPE CHAR(1) DEFAULT '1' NOT NULL,
FNODEINFOID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_CHKNOTEINFO') 
 CREATE TABLE T_BCM_CHKNOTEINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FDIMSTR VARCHAR(255) DEFAULT ' ' NOT NULL,
FDIMENSIONSUM INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHKFORMULASETTING' AND KSQL_COL_NAME IN ('FDESCRIPTION')) 
 ALTER TABLE T_BCM_CHKFORMULASETTING ADD (FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHKREPORT' AND KSQL_COL_NAME IN ('FCURRENCY')) 
 ALTER TABLE T_BCM_CHKREPORT ADD (FCURRENCY BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHKREPORT' AND KSQL_COL_NAME IN ('FLEFTRESULT')) 
 ALTER TABLE T_BCM_CHKREPORT ADD (FLEFTRESULT VARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHKREPORT' AND KSQL_COL_NAME IN ('FRIGHTRESULT')) 
 ALTER TABLE T_BCM_CHKREPORT ADD (FRIGHTRESULT VARCHAR(2000) DEFAULT ' ' NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BCM_table.sql **/
