/**BEGIN E:\NEXTERP_PDM\PDM_UPGRADE\PDMS\BRANCH_LASTEST\PDM\EB_TABLE.SQL **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DIFFANALYZESCHEME' AND KSQL_COL_NAME ='FSTATUS') 
ALTER TABLE T_EB_DIFFANALYZESCHEME ADD (FSTATUS VARCHAR(1) DEFAULT '1');

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DIFFANALYZESCHEME' AND KSQL_COL_NAME ='FDESC') 
ALTER TABLE T_EB_DIFFANALYZESCHEME ADD (FDESC VARCHAR(750) DEFAULT ' ');

 EXEC p_AlterColumn 'T_EB_DIFFANALYZESCHEME', 'FNAME', 'NVARCHAR(300)', 'NOT NULL', '0100', ''' ''';
 EXEC p_AlterColumn 'T_EB_DIFFANALYZESCHEME', 'FNUMBER', 'NVARCHAR(100)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXECSCHEMEENTITY') 
 CREATE TABLE T_EB_EXECSCHEMEENTITY (
FID  BIGINT NOT NULL DEFAULT 0,
FNAME VARCHAR(300) NOT NULL DEFAULT ' ',
FNUMBER VARCHAR(100) NOT NULL DEFAULT ' ',
FMODELID BIGINT NOT NULL DEFAULT 0,
FBIZMODELID BIGINT NOT NULL DEFAULT 0,
FTYPE CHAR(1) NOT NULL DEFAULT '2',
FSTATUS CHAR(1) NOT NULL DEFAULT '1',
FISPRESET CHAR(1) NOT NULL DEFAULT '0',
FDESC VARCHAR(750) DEFAULT ' ',
FMEMBERJSON NCLOB,
FMEMBERJSON_TAG NCLOB,
FCREATERID BIGINT NOT NULL DEFAULT 0,
FCREATEDATE DATETIME,
FMODIFIERID BIGINT NOT NULL DEFAULT 0,
FMODIFYDATE DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXECCOLENTITY') 
 CREATE TABLE T_EB_EXECCOLENTITY (
FID  BIGINT NOT NULL DEFAULT 0,
FORDER BIGINT NOT NULL DEFAULT 0,
FEXESCHEMEID BIGINT NOT NULL DEFAULT 0,
FNUMBER VARCHAR(50) NOT NULL DEFAULT ' ',
FANALYSEINFO VARCHAR(500) NOT NULL DEFAULT ' ',
FFORMULA VARCHAR(500) NOT NULL DEFAULT ' ',
FNAME VARCHAR(75) NOT NULL DEFAULT ' ',
FISSHOW CHAR(1) NOT NULL DEFAULT '1',
FCREATERID BIGINT NOT NULL DEFAULT 0,
FCREATEDATE DATETIME,
FMODIFIERID BIGINT NOT NULL DEFAULT 0,
FMODIFYDATE DATETIME,
FCOLTYPE CHAR(1) NOT NULL DEFAULT 'B',
FDESC VARCHAR(255) NOT NULL DEFAULT ' '
);

/**END E:\NEXTERP_PDM\PDM_UPGRADE\PDMS\BRANCH_LASTEST\PDM\EB_TABLE.SQL **/