
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_WRITEOFFSCHEME') 
 CREATE TABLE T_EB_WRITEOFFSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(200) DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_WRITEOFFINFOSELECT') 
 CREATE TABLE T_EB_WRITEOFFINFOSELECT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFBILL BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWRITEOFFSOURCEBILL BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFENTRY BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFVALUE BIGINT DEFAULT 0 NOT NULL,
FWRITEOFFSOURCEBILLENTRY BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BGCONPROCESSENTRY' AND KSQL_COL_NAME IN ('FWRITEOFFSCHEME')) 
 ALTER TABLE T_EB_BGCONPROCESSENTRY ADD (FWRITEOFFSCHEME BIGINT DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BGCONPROCESSENTRY' AND KSQL_COL_NAME IN ('FWRITEOFFSCHEMECN')) 
 ALTER TABLE T_EB_BGCONPROCESSENTRY ADD (FWRITEOFFSCHEMECN NVARCHAR(50) DEFAULT ' ' NOT NULL );