/*ALIAS>l_data*/

/*SQLStart>505*/
alter table termperm
  add TP_NOMTXTSORT VARCHAR(50);
/*SQLStop*/

/*SQLStart>506*/
update TERMPERM
  set TP_NOMTXTSORT = ALeftIDSort(TP_NOMTXT);
/*SQLStop*/

/*SQLStart>507*/
alter table LICENSES
  add L_NOSORT VARCHAR(50);
/*SQLStop*/

/*SQLStart>508*/
update LICENSES
  set L_NOSORT = ALeftIDSort(L_NO);
/*SQLStop*/

/*SQLStart>509*/
alter table OBJECTREGISTER
  add OR_NOMTXTSORT VARCHAR(50);
/*SQLStop*/

/*SQLStart>510*/
update OBJECTREGISTER
  set OR_NOMTXTSORT = ALeftIDSort(OR_NOMTXT);
/*SQLStop*/

/*SQLStart>511*/
CREATE TRIGGER TPTRIGGERFORSORT FOR TERMPERM
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
as
begin
  New.TP_NOMTXTSORT=ALeftIDSort(New.TP_NOMTXT);
end
/*SQLStop*/

/*SQLStart>512*/
CREATE TRIGGER LTRIGGERFORSORT FOR LICENSES
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
as
begin
  New.L_NOSORT=ALeftIDSort(New.L_NO);
end
/*SQLStop*/

/*SQLStart>513*/
CREATE TRIGGER ORTRIGGERFORSORT FOR OBJECTREGISTER
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
as
begin
  New.OR_NOMTXTSORT=ALeftIDSort(New.OR_NOMTXT);
end
/*SQLStop*/
