/**Begin D:\PDM_UPGRADE\PDM1\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_APPROVEBILL' AND KSQL_COL_NAME ='FRPTPROCESSTYPE') 
 ALTER TABLE T_EB_APPROVEBILL ADD (FRPTPROCESSTYPE CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_APPROVELNOTE' AND KSQL_COL_NAME ='FRPTENTITYID') 
 ALTER TABLE T_EB_APPROVELNOTE ADD (FRPTENTITYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TEMPLATEORG') 
 CREATE TABLE T_EB_TEMPLATEORG (
FID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FORGRANGE CHAR(5) DEFAULT '10' NOT NULL,
FALLOCATERID BIGINT DEFAULT 0 NOT NULL,
FALLOCATETIME DATETIME,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DYNAMICREPORT' AND KSQL_COL_NAME ='FSCHEMEASSIGNID') 
 ALTER TABLE T_EB_DYNAMICREPORT ADD (FSCHEMEASSIGNID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_REPORTATTACHMENT' AND KSQL_COL_NAME ='FRPTENTITYID') 
 ALTER TABLE T_EB_REPORTATTACHMENT ADD (FRPTENTITYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPTSCHEME') 
 CREATE TABLE T_EB_RPTSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZRANGEID BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT '1' NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME,
FSEQ INT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RPTSCHEME_L') 
 CREATE TABLE T_EB_RPTSCHEME_L (
FPKID NVARCHAR(20) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SCHEMEASSIGN') 
 CREATE TABLE T_EB_SCHEMEASSIGN (
FID BIGINT DEFAULT 0 NOT NULL,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FYEARID BIGINT DEFAULT 0 NOT NULL,
FDATATYPEID BIGINT DEFAULT 0 NOT NULL,
FVERSIONID BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZRANGEID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TEMPLATEUSER') 
 CREATE TABLE T_EB_TEMPLATEUSER (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FUSERID NVARCHAR(50) DEFAULT '0' NOT NULL,
FPERMISSIONFLAG CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FUSERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\EB_table.sql **/
