--1. get all indexes from current db, place in temp table select schemaName = s.name, tablename = object_name(i.id), tableid = i.id, indexid = i.indid, indexname = i.name, i.status, isunique = indexproperty (i.id,i.name,'isunique'), isclustered = ind…