 EXEC P_ALTERPK 'PK_T_PERM_DATARULE', 'T_PERM_DATARULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_DATARULE') CREATE INDEX IDX_PERM_DATARULE ON T_PERM_DATARULE ( FBIZAPPID ,FENTITYNUM );


 EXEC P_ALTERPK 'PK_T_PERM_DATARULE_ENTRY', 'T_PERM_DATARULE_ENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_DATARULE_ENTRY') CREATE INDEX IDX_PERM_DATARULE_ENTRY ON T_PERM_DATARULE_ENTRY ( FID ,FPERMITEMID );

 EXEC P_ALTERPK 'PK_T_PERM_DATARULE_L', 'T_PERM_DATARULE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_PERM_DATARULES_L', 'T_PERM_DATARULES_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_PERM_ROLEDATARULES', 'T_PERM_ROLEDATARULES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_ROLEDATARULES') CREATE INDEX IDX_PERM_ROLEDATARULES ON T_PERM_ROLEDATARULES ( FROLEID );


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_DATARULE_PROP') CREATE INDEX IDX_PERM_DATARULE_PROP ON T_PERM_DATARULE_PROP ( FPROPKEY );


 EXEC P_ALTERPK 'PK_T_PERM_DATARULES', 'T_PERM_DATARULES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_DATARULES') CREATE INDEX IDX_PERM_DATARULES ON T_PERM_DATARULES ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_PERM_DATARULES_ENTRY', 'T_PERM_DATARULES_ENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_DATARULES_ENTRY') CREATE INDEX IDX_PERM_DATARULES_ENTRY ON T_PERM_DATARULES_ENTRY ( FID ,FBIZAPPID ,FENTITYNUM );


 EXEC P_ALTERPK 'PK_T_PERM_USERDATARULES', 'T_PERM_USERDATARULES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_USERDATARULES') CREATE INDEX IDX_PERM_USERDATARULES ON T_PERM_USERDATARULES ( FUSERID );
 

 
