/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILLENTRY' AND KSQL_COL_NAME ='FREFUNDAMT') 
 ALTER TABLE T_CAS_AGENTPAYBILLENTRY ADD (FREFUNDAMT DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILLENTRY' AND KSQL_COL_NAME ='FREFUNDDES') 
 ALTER TABLE T_CAS_AGENTPAYBILLENTRY ADD (FREFUNDDES NVARCHAR(255) );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILLENTRY' AND KSQL_COL_NAME ='FREFUNDAMT') 
 ALTER TABLE T_CAS_PAYMENTBILLENTRY ADD (FREFUNDAMT DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_PAYMENTBILLENTRY' AND KSQL_COL_NAME ='FREFUNDDES') 
 ALTER TABLE T_CAS_PAYMENTBILLENTRY ADD (FREFUNDDES NVARCHAR(255) );
 EXEC p_AlterColumn 'T_CAS_FUNDFLOWITEM', 'FREMARK', 'NVARCHAR(255)', 'NOT NULL', '0011', ''' ''';

 EXEC p_AlterColumn 'T_CAS_FUNDFLOWITEM', 'FLONGNUMBER', 'VARCHAR(500)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_CAS_FUNDFLOWITEM', 'FFULLNAME', 'NVARCHAR(255)', 'NOT NULL', '0011', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_FUNDFLOWITEM' AND KSQL_COL_NAME ='FCREATEORGID') 
 ALTER TABLE T_CAS_FUNDFLOWITEM ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_FUNDFLOWITEM' AND KSQL_COL_NAME ='FORGID') 
 ALTER TABLE T_CAS_FUNDFLOWITEM ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_FUNDFLOWITEM' AND KSQL_COL_NAME ='FCTRLSTRATEGY') 
 ALTER TABLE T_CAS_FUNDFLOWITEM ADD (FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_FUNDFLOWITEM' AND KSQL_COL_NAME ='FENABLEDATE') 
 ALTER TABLE T_CAS_FUNDFLOWITEM ADD (FENABLEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_FUNDFLOWITEM' AND KSQL_COL_NAME ='FDISABLEDATE') 
 ALTER TABLE T_CAS_FUNDFLOWITEM ADD (FDISABLEDATE DATETIME );

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