IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FTOTAL_TAX_AMOUNT')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FTOTAL_TAX_AMOUNT DECIMAL(23,2) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FINVOICE_AMOUNT')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FINVOICE_AMOUNT DECIMAL(23,2) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FBUYER_ADDRESS')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FBUYER_ADDRESS NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FBUYER_ACCOUNT')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FBUYER_ACCOUNT NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FBUYER_TAX_NO')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FBUYER_TAX_NO NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FSALER_ADDRESS')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FSALER_ADDRESS NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FSALER_ACCOUNT')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FSALER_ACCOUNT NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FPAYMENT_TYPE')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FPAYMENT_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FCOUNTRY')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FCOUNTRY NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FPURCHASE_ORDER_NUMBER')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FPURCHASE_ORDER_NUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FDELIVERY_DATE')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FDELIVERY_DATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FDELIVER_NOTE_NUMBER')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FDELIVER_NOTE_NUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OVERSEA' AND KSQL_COL_NAME ='FEXT_INFO')
 ALTER TABLE T_RIM_INV_OVERSEA ADD (FEXT_INFO NVARCHAR(500) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INV_OVERSEA_ITEM')
 CREATE TABLE T_RIM_INV_OVERSEA_ITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLINE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FGOODS_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGOODS_NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSALES_ORDER_NUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSPEC_MODEL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNUM BIGINT DEFAULT 0 NOT NULL,
FUNIT_PRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNET_PRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDETAIL_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_RATE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDISCOUNT_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXT_ITEM NVARCHAR(500) DEFAULT ' ' NOT NULL,
FTAX_RATE_RESERVE1 NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_AMOUNT_RESERVE1 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_TYPE_RESERVE1 NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_RATE_RESERVE2 NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_AMOUNT_RESERVE2 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_TYPE_RESERVE2 NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_RATE_RESERVE3 NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_AMOUNT_RESERVE3 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_TYPE_RESERVE3 NVARCHAR(50) DEFAULT ' ' NOT NULL
);
