Subject | Re: [firebird-support] Dropping an unnamed constraint |
---|---|
Author | Tetram Corp |
Post date | 2007-10-04T15:23:16Z |
hi,
something like:
select rc.rdb$constraint_name
from rdb$relation_constraints rc
inner join rdb$index_segments is
on rc.rdb$index_name = is.rdb$index_name
where rc.rdb$contraint_type = 'UNIQUE'
and rc.rdb$relation_name = 'YOURTABLE'
and is.rdb$field_name = 'NUMBER'
should retrun what you need
be careful, is this field appears in more than one unique contraint of
your table, you will have more than one result
Regards,
Thierry
Tobias Grimm a écrit :
something like:
select rc.rdb$constraint_name
from rdb$relation_constraints rc
inner join rdb$index_segments is
on rc.rdb$index_name = is.rdb$index_name
where rc.rdb$contraint_type = 'UNIQUE'
and rc.rdb$relation_name = 'YOURTABLE'
and is.rdb$field_name = 'NUMBER'
should retrun what you need
be careful, is this field appears in more than one unique contraint of
your table, you will have more than one result
Regards,
Thierry
Tobias Grimm a écrit :
> Hi!
>
> When creating e.g. a UNIQUE constraint with:
>
> ALTER TABLE PRODUCT ADD UNIQUE (NUMBER);
>
> ...without specifying a constraint name, the contstraint gets a "random"
> name like "INTEG_36".
>
> How can I query this automatically created constraint name (given the
> table name, column name and constraint type), to be able to drop it?
>
> bye,
> Tobias
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>