IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDER_A' AND KSQL_COL_NAME ='FREJECTREASON') 
 ALTER TABLE T_PUR_ORDER_A ADD (FREJECTREASON NVARCHAR(512) DEFAULT ' ');
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_CHECK_A' AND KSQL_COL_NAME ='FREJECTREASON') 
 ALTER TABLE T_PUR_CHECK_A ADD (FREJECTREASON NVARCHAR(512) DEFAULT ' ');
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INVOICE_A' AND KSQL_COL_NAME ='FREJECTREASON') 
 ALTER TABLE T_PUR_INVOICE_A ADD (FREJECTREASON NVARCHAR(512) DEFAULT ' ');
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_CHECREJECTREASONATT') 
 CREATE TABLE T_PUR_CHECREJECTREASONATT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_INVREJECTREASONATT') 
 CREATE TABLE T_PUR_INVREJECTREASONATT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_ORDEREJECTREASONATT') 
 CREATE TABLE T_PUR_ORDEREJECTREASONATT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);