IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FHASINVOICE'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FHASINVOICE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FORDERSORT'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FORDERSORT VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FSERVICEFEEPAYTYPE'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FSERVICEFEEPAYTYPE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FBILLPERIOD'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FBILLPERIOD DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FISRECONCILIATION'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FISRECONCILIATION CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FSETTLEMENTAMOUNT'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FSETTLEMENTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FFORMID'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FFORMID VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALBILL' AND KSQL_COL_NAME IN ('FSERVICEFEEPAYTYPE'))
ALTER TABLE T_ER_MEALBILL ADD (FSERVICEFEEPAYTYPE CHAR(1) DEFAULT ' ' NOT NULL );
EXEC p_AlterColumn 'T_ER_MEALCHECKINGBILL_L', 'FPKID', 'VARCHAR(50)', 'NOT NULL', '1111', ''' ''';
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FPARENTORDERNUM'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FPARENTORDERNUM VARCHAR(50) DEFAULT ' ' NOT NULL);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_MEALCHECKINGBILL' AND KSQL_COL_NAME IN ('FACCOUNTID'))
ALTER TABLE T_ER_MEALCHECKINGBILL ADD (FACCOUNTID VARCHAR(50) DEFAULT ' ' NOT NULL);