Subject | Re: Rename Primary Key Foreign Key or Index |
---|---|
Author | Svein Erling |
Post date | 2003-10-03T12:58:41Z |
Well, Iliya, you can find its name by issuing something like
select i.rdb$index_name
from rdb$indices i
where i.rdb$relation_name = <name of table>
and exists (select * from rdb$index_segments s
where i.rdb$index_name = s.rdb$index_name
and s.rdb$field_name = <field names>)
and exists (select * from rdb$index_segments s
where i.rdb$index_name = s.rdb$index_name
and s.rdb$field_name = <field names>)
... //repeat as many times as number of fields in the index
and not exists (select * from rdb$index_segments s
where i.rdb$index_name = s.rdb$index_name
and s.rdb$field_name NOT IN (<list of field names>))
I have never tried doing anything like this, but it should not be too
difficult unless you have several indexes covering the same columns
(and if so, just add criteria for s.field_position).
HTH,
Set
select i.rdb$index_name
from rdb$indices i
where i.rdb$relation_name = <name of table>
and exists (select * from rdb$index_segments s
where i.rdb$index_name = s.rdb$index_name
and s.rdb$field_name = <field names>)
and exists (select * from rdb$index_segments s
where i.rdb$index_name = s.rdb$index_name
and s.rdb$field_name = <field names>)
... //repeat as many times as number of fields in the index
and not exists (select * from rdb$index_segments s
where i.rdb$index_name = s.rdb$index_name
and s.rdb$field_name NOT IN (<list of field names>))
I have never tried doing anything like this, but it should not be too
difficult unless you have several indexes covering the same columns
(and if so, just add criteria for s.field_position).
HTH,
Set