/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_constraint.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATE' AND KSQL_COL_NAME ='FVERSIONDESCRIPTION') 
 ALTER TABLE T_BCM_TEMPLATE ADD (FVERSIONDESCRIPTION VARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATE' AND KSQL_COL_NAME ='FEXPIRINGDATE') 
 ALTER TABLE T_BCM_TEMPLATE ADD (FEXPIRINGDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATE' AND KSQL_COL_NAME ='FSTATUS') 
 ALTER TABLE T_BCM_TEMPLATE ADD (FSTATUS CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_TEMPLATE_L') 
 CREATE TABLE T_BCM_TEMPLATE_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(20) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(500) DEFAULT ' ' NOT NULL,
FEDITDESCRIPTION NCLOB,
FVERSIONDESCRIPTION NVARCHAR(500) DEFAULT ' ' NOT NULL
);

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