/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
 EXEC p_AlterColumn 'T_EB_REPORTSHARE', 'FORMID', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';
 EXEC p_AlterColumn 'T_EB_REPORTSHARE_L', 'FPKID', 'NVARCHAR(30)', 'NOT NULL', '1111', ''' ''';
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_REPORTSHARE' AND KSQL_COL_NAME ='FORMIDSTRING') 
 ALTER TABLE T_EB_REPORTSHARE ADD (FORMIDSTRING NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CUSTOMPROPERTY') 
 CREATE TABLE T_EB_CUSTOMPROPERTY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FSOURCE CHAR(1) DEFAULT '0' NOT NULL,
FDSEQ INT DEFAULT 0 NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CUSTOMPROPERTYVALUE') 
 CREATE TABLE T_EB_CUSTOMPROPERTYVALUE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCE CHAR(1) DEFAULT '0' NOT NULL,
FPROPERTYID BIGINT DEFAULT 0 NOT NULL,
FDSEQ INT DEFAULT 0 NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RULEFUNCTION') 
 CREATE TABLE T_EB_RULEFUNCTION (
FID BIGINT DEFAULT 0 NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FFUNCTIONTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFUNCTIONKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFUNCTIONSHOWSTR NCLOB,
FFUNCTIONINFOSTR NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CUSTOMPROPERTY_L') 
 CREATE TABLE T_EB_CUSTOMPROPERTY_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MEMBERPROPERTYVALUE') 
 CREATE TABLE T_EB_MEMBERPROPERTYVALUE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPROPERTYVALUEID BIGINT DEFAULT 0 NOT NULL
);


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
