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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_STRUCTOFBPERIOD') 
 CREATE TABLE T_EB_STRUCTOFBPERIOD (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLONGNUMBER NVARCHAR(200) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FISLEAF CHAR(1) DEFAULT ' ' NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAGGOPRT CHAR(1) DEFAULT ' ' NOT NULL,
FEFFDATE VARCHAR(30) DEFAULT ' ' NOT NULL,
FEXPDATE VARCHAR(30) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(5) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FEFFMONTH VARCHAR(2) DEFAULT ' ' NOT NULL,
FEFFDAY VARCHAR(2) DEFAULT ' ' NOT NULL,
FEXPMONTH VARCHAR(2) DEFAULT ' ' NOT NULL,
FEXPDAY VARCHAR(2) DEFAULT ' ' NOT NULL,
FMEMBERSOURCE CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
VIEWID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_STRUCTOFBPERIOD_L') 
 CREATE TABLE T_EB_STRUCTOFBPERIOD_L (
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FANOTHERNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_STRUCTOFACCOUNT' AND KSQL_COL_NAME ='FCHANGETYPE') 
 ALTER TABLE T_EB_STRUCTOFACCOUNT ADD (FCHANGETYPE BIGINT DEFAULT 0 NOT NULL );

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