/**BEGIN  **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BUSINESSRELATIONLOG')
CREATE TABLE T_EB_BUSINESSRELATIONLOG
(
	FID            BIGINT           DEFAULT 0   NOT NULL,
    FBUSINESSMODEL BIGINT 			DEFAULT 0   NOT NULL,
	FDATASET       BIGINT 			DEFAULT 0   NOT NULL,
	FSTATUS        CHAR(1)          DEFAULT ' ' NOT NULL,
    FVALIDSET      NCLOB 			DEFAULT ' ' NOT NULL,
    FERRORINFO     NCLOB 			DEFAULT ' ' NOT NULL,
    FCREATORID     BIGINT 			DEFAULT 0   NOT NULL,
    FMODIFIERID    BIGINT 			DEFAULT 0   NOT NULL,
    FCREATETIME    DATETIME,
    FMODIFYTIME    DATETIME
    
);
EXEC P_ALTERPK 'PK_T_EB_BUSINESSRELATIONLOG', 'T_EB_BUSINESSRELATIONLOG', 'FID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_BUSINESSRELATIONLOG')
CREATE INDEX IDX_EB_BUSINESSRELATIONLOG ON T_EB_BUSINESSRELATIONLOG (FBUSINESSMODEL ASC);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BUSINESSMODEL' AND KSQL_COL_NAME IN ('FRELATIONDATE')) 
ALTER TABLE T_EB_BUSINESSMODEL ADD (FRELATIONDATE DATETIME);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BUSINESSMODEL' AND KSQL_COL_NAME IN ('FRELATIONSTATUS')) 
ALTER TABLE T_EB_BUSINESSMODEL ADD (FRELATIONSTATUS NVARCHAR(50)  DEFAULT ' ' NOT NULL);
/**END **/