/**Begin D:\softwaresetup\PDM_UPGRADE\PDM1\FPM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORTDATADETAIL' AND KSQL_COL_NAME IN ('FREMARK')) 
 ALTER TABLE T_FPM_REPORTDATADETAIL ADD (FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORTDATAMAIN' AND KSQL_COL_NAME IN ('FEFFECTFLAG')) 
 ALTER TABLE T_FPM_REPORTDATAMAIN ADD (FEFFECTFLAG CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORTDATAMAIN' AND KSQL_COL_NAME IN ('FREPORTPERIOD')) 
 ALTER TABLE T_FPM_REPORTDATAMAIN ADD (FREPORTPERIOD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORTDATAMAIN' AND KSQL_COL_NAME IN ('FMAINTABLE'))
 ALTER TABLE T_FPM_REPORTDATAMAIN ADD (FMAINTABLE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORTDATAMAIN' AND KSQL_COL_NAME IN ('FAMOUNTUNIT'))
 ALTER TABLE T_FPM_REPORTDATAMAIN ADD (FAMOUNTUNIT VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORT' AND KSQL_COL_NAME IN ('FINITFLAG'))
 ALTER TABLE T_FPM_REPORT ADD (FINITFLAG CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FPM_REPORT' AND KSQL_COL_NAME IN ('FPARENTTEMPLATEID'))
 ALTER TABLE T_FPM_REPORT ADD (FPARENTTEMPLATEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_REPORT_PERIOD')
 CREATE TABLE T_FPM_REPORT_PERIOD (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


 EXEC p_AlterColumn 'T_FPM_FPMBILLGENRECORD', 'FEXECRESULT', 'VARCHAR(500)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_FPM_FPMBILLGENRECORD', 'FEXECRESULTDETAIL', 'VARCHAR(500)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_FPM_FPMBILLGENRECORD', 'FTEVIEWDETAIL', 'VARCHAR(500)', 'NOT NULL', '0100', ''' ''';



/**End D:\softwaresetup\PDM_UPGRADE\PDM1\FPM_table.sql **/
