
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FPREDTIME')
 ALTER TABLE T_MDS_WRTFF ADD (FPREDTIME BIGINT DEFAULT 1 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FRUNNINGTYPE')
 ALTER TABLE T_MDS_WRTFF ADD (FRUNNINGTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FLOSEDATE')
 ALTER TABLE T_MDS_WRTFF ADD (FLOSEDATE DATETIME );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FREPEATTYPE')
 ALTER TABLE T_MDS_WRTFF ADD (FREPEATTYPE    NVARCHAR(30) DEFAULT ' ' NOT NULL);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FREPEAT')
 ALTER TABLE T_MDS_WRTFF ADD (FREPEAT NVARCHAR(50)  DEFAULT '0' NOT NULL);

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FDAYSOFWEEK')
 ALTER TABLE T_MDS_WRTFF ADD (FDAYSOFWEEK    NVARCHAR(50) DEFAULT ' ' NOT NULL);

  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FDAYSOFMON')
 ALTER TABLE T_MDS_WRTFF ADD (FDAYSOFMON     NVARCHAR(50)DEFAULT ' ' NOT NULL);

   IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FBILLSTATUS')
 ALTER TABLE T_MDS_WRTFF ADD (FBILLSTATUS    NVARCHAR(50) DEFAULT ' ' NOT NULL);

    IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FPLANID')
 ALTER TABLE T_MDS_WRTFF ADD (FPLANID      NVARCHAR(50) DEFAULT ' ' NOT NULL);

    IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_WRTFF' AND KSQL_COL_NAME ='FJOBID')
 ALTER TABLE T_MDS_WRTFF ADD (FJOBID       NVARCHAR(50) DEFAULT ' ' NOT NULL);