/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_constraint.sql **/
 EXEC P_ALTERPK 'PK_BAS_COMPARETYPEAPPS', 'T_BAS_COMPARETYPEAPPS', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_COMPARETYPEAPPS_BDID') CREATE INDEX IDX_BAS_COMPARETYPEAPPS_BDID ON T_BAS_COMPARETYPEAPPS ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_T_BAS_COMPARETYPEFIELD', 'T_BAS_COMPARETYPEFIELD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_COMPARETYPES_NUMBER') CREATE UNIQUE INDEX IDX_BAS_COMPARETYPES_NUMBER ON T_BAS_COMPARETYPEFIELD ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BAS_COMPARETYPEFIELD_L', 'T_BAS_COMPARETYPEFIELD_L', 'FPKID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_COMPARETYPEFIELD_L_FID') CREATE  CLUSTERED INDEX IDX_BAS_COMPARETYPEFIELD_L_FID ON T_BAS_COMPARETYPEFIELD_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BAS_COMPARETYPES_L', 'T_BAS_COMPARETYPES_L', 'FPKID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_COMPARETYPES_L_FID') CREATE  CLUSTERED INDEX IDX_BAS_COMPARETYPES_L_FID ON T_BAS_COMPARETYPES_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BAS_COMPARETYPES', 'T_BAS_COMPARETYPES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_COMPARETYPES_FNUMBER') CREATE UNIQUE INDEX IDX_BAS_COMPARETYPES_FNUMBER ON T_BAS_COMPARETYPES ( FNUMBER );



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