IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ELECTRIC' AND KSQL_COL_NAME ='FPURCHASE_TICKET')
 ALTER TABLE T_RIM_INV_ELECTRIC ADD (FPURCHASE_TICKET NVARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_CUSTOM' AND KSQL_COL_NAME ='FPURCHASE_TICKET')
 ALTER TABLE T_RIM_INV_CUSTOM ADD (FPURCHASE_TICKET NVARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FPURCHASE_TICKET')
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FPURCHASE_TICKET NVARCHAR(2) DEFAULT '0' NOT NULL );

 EXEC p_AlterColumn 'T_RIM_INV_ORDINARY', 'FPURCHASE_TICKET', 'NVARCHAR(2)', 'NOT NULL', '0001', '''0''';
