drop index if exists apps_desc_idx;
drop index if exists apptempl_desc_idx;
drop index if exists js_packs_desc_idx;
drop index if exists reports_desc_idx;

update APPS set DESCRIPTION = left(DESCRIPTION, 512);
update APPTEMPLATES set DESCRIPTION = left(DESCRIPTION, 512);
update JS_PACKS set P_DESC = left(P_DESC, 512);
update REPORT_TEMPLATES set DESCRIPTION = left(DESCRIPTION, 512);
	
alter table APPS alter column DESCRIPTION type varchar(512);
alter table APPTEMPLATES alter column DESCRIPTION type varchar(512);
alter table JS_PACKS alter column P_DESC type varchar(512);
alter table REPORT_TEMPLATES alter column DESCRIPTION type varchar(512);

create index apps_desc_idx on APPS (DESCRIPTION);
create index apptempl_desc_idx on APPTEMPLATES (DESCRIPTION);
create index js_packs_desc_idx on JS_PACKS (P_DESC);
create index reports_desc_idx on REPORT_TEMPLATES (DESCRIPTION);