IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_AIR' AND KSQL_COL_NAME ='FINTERNATIONAL_FLAG')
 ALTER TABLE T_RIM_INV_AIR ADD (FINTERNATIONAL_FLAG NVARCHAR(2) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INVOICE_VOUCHER')
 CREATE TABLE T_RIM_INVOICE_VOUCHER (
FID BIGINT DEFAULT 0 NOT NULL,
FSERIAL_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FXBRL_NAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FXBRL_URL NVARCHAR(200) DEFAULT ' ' NOT NULL,
FRECEIVE_XBRL_URL NVARCHAR(150) DEFAULT ' ',
FRECEIVE_XBRL_NAME NVARCHAR(200) DEFAULT ' ',
FCREATE_TIME DATETIME,
FUPDATE_TIME DATETIME
);

EXEC P_ALTERPK 'PK_T_RIM_INVOICE_VOUCHER', 'T_RIM_INVOICE_VOUCHER', 'FID', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INVOICE_VOUCHER_SERIAL') CREATE  CLUSTERED INDEX IDX_RIM_INVOICE_VOUCHER_SERIAL ON T_RIM_INVOICE_VOUCHER ( FSERIAL_NO );