Subject Re: [firebird-support] Droppping UNIQUE constraint
Author PenWin
Thanks for the answer. It turns out I was using wrong names, that's the
reason I couldn't find the constraint name. When I fixed it, I got the name
and could drop the constraint. If someone needs it, the SQL query is:

select c.rdb$constraint_name
from rdb$relation_constraints c
left join rdb$index_segments i on i.rdb$index_name=c.rdb$index_name
where c.rdb$relation_name='TABLE_NAME_IN_CAPS'
and c.rdb$constraint_type='UNIQUE'
and i.rdb$field_name='FIELD_NAME_IN_CAPS'

Pepak

----- Original Message -----
From: "Ann W. Harrison" <aharrison@...>
To: <firebird-support@yahoogroups.com>
Sent: Friday, December 01, 2006 9:36 PM
Subject: Re: [firebird-support] Droppping UNIQUE constraint


> PenWin wrote:
>> Hi!
>>
>> Yet another question. Some time ago I set a table column to be unique:
>>
>> ALTER TABLE tablename ADD UNIQUE(column)
>>
>> Now I discover that I in fact can't have this column unique. How do I
>> drop
>> the constraint? The documentation seems to suggest something like
>>
>> ALTER TABLE tablename DROP CONSTRAINT UNIQUE(column)
>>
>> But that results in invalid keyword "unique".
>
> I think you're going to have to grub around in the
> RDB$RELATION_CONSTRAINTS table for the actual name of
> the constraint.
>
>
> Regards,
>
>
> Ann
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> 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
>
>
>
>
>