 EXEC P_ALTERPK 'PK_T_PERM_USERADMINGROUP', 'T_PERM_USERADMINGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_USERADMINGROUP') CREATE INDEX IDX_PERM_USERADMINGROUP ON T_PERM_USERADMINGROUP ( FADMINGROUPID );

  EXEC P_ALTERPK 'PK_T_PERM_ADMINGROUP', 'T_PERM_ADMINGROUP', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_PERM_ADMINGROUP_L', 'T_PERM_ADMINGROUP_L', 'FPKID', '1';

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