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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_BIZORGCHECKCONFIG') 
 CREATE TABLE T_ER_BIZORGCHECKCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FFUNTYPE NVARCHAR(10) DEFAULT ' ' NOT NULL,
FENTITYTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_BIZORGCHECKDETAIL') 
 CREATE TABLE T_ER_BIZORGCHECKDETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTITY NVARCHAR(100) DEFAULT ' ' NOT NULL,
FKEY NVARCHAR(100) DEFAULT ' ' NOT NULL
);


 EXEC P_ALTERPK 'PK_T_ER_BIZORGCHECKCONFIG', 'T_ER_BIZORGCHECKCONFIG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_BIZORGCK_TYPE') CREATE INDEX IDX_ER_BIZORGCK_TYPE ON T_ER_BIZORGCHECKCONFIG ( FENTITYTYPE );


 EXEC P_ALTERPK 'PK_T_ER_BIZORGCHECKDETAIL', 'T_ER_BIZORGCHECKDETAIL', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_BIZORGCK_ENTITY') CREATE INDEX IDX_ER_BIZORGCK_ENTITY ON T_ER_BIZORGCHECKDETAIL ( FENTITY ,FSEQ );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_BIZORGCK_KEY') CREATE INDEX IDX_ER_BIZORGCK_KEY ON T_ER_BIZORGCHECKDETAIL ( FKEY );

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