/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BAS_SCRIPTPRISETTING', 'T_BAS_SCRIPTPRISETTING', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_USERPRINTER', 'T_BAS_USERPRINTER', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_VARIABLE', 'T_BAS_VARIABLE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_VARIABLE_N') CREATE UNIQUE INDEX IDX_BAS_VARIABLE_N ON T_BAS_VARIABLE ( FNUMBER ,FGROUPID );


 EXEC P_ALTERPK 'PK_T_BAS_VARIABLEMAPPING', 'T_BAS_VARIABLEMAPPING', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_MAPPINFIELD', 'T_BAS_MAPPINFIELD', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_MAPPINGFIELD_ID') CREATE INDEX IDX_BAS_MAPPINGFIELD_ID ON T_BAS_MAPPINFIELD ( FID );


 EXEC P_ALTERPK 'PK_T_BAS_PRIENTRY', 'T_BAS_PRIENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_PRIENTRY_ID') CREATE INDEX IDX_BAS_PRIENTRY_ID ON T_BAS_PRIENTRY ( FID );


 EXEC P_ALTERPK 'PK_T_BAS_VARIABLEGROUP', 'T_BAS_VARIABLEGROUP', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_SCRIPTTEMPLATE', 'T_BAS_SCRIPTTEMPLATE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_MAPPINFIELD_L', 'T_BAS_MAPPINFIELD_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_MAPPINGFIELD_L') CREATE INDEX IDX_BAS_MAPPINGFIELD_L ON T_BAS_MAPPINFIELD_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_BAS_SCRIPTPRISETTING_L', 'T_BAS_SCRIPTPRISETTING_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_SCRIPTTEMPLATE_L', 'T_BAS_SCRIPTTEMPLATE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_USERPRINTER_L', 'T_BAS_USERPRINTER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_USERPRINTERSETTING', 'T_BAS_USERPRINTERSETTING', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BAS_USERPRINTERSETTING') CREATE INDEX IDX_BAS_USERPRINTERSETTING ON T_BAS_USERPRINTERSETTING ( FID );


 EXEC P_ALTERPK 'PK_T_BAS_VARIABLE_L', 'T_BAS_VARIABLE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_VARIABLEGROUP_L', 'T_BAS_VARIABLEGROUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BAS_VARIABLEMAPPING_L', 'T_BAS_VARIABLEMAPPING_L', 'FPKID', '1';

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



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