Subject Re: [firebird-support] retrieve the metadata showing the constraint field
Author Alexandre Magno
Hi...

try this:

SQL> SELECT RIS.RDB$FIELD_NAME, RRC.RDB$CONSTRAINT_TYPE
CON> FROM RDB$RELATION_CONSTRAINTS RRC JOIN RDB$INDEX_SEGMENTS RIS
CON> ON (RRC.RDB$INDEX_NAME = RIS.RDB$INDEX_NAME)
CON> WHERE RRC.RDB$RELATION_NAME = 'CUSTOMER';


RDB$FIELD_NAME RDB$CONSTRAINT_TYPE
=============================== ===================

CUST_NO PRIMARY KEY
COUNTRY FOREIGN KEY

If you want to include in the result set constraints that don't
create indices remove ON clause.

Cheers.

Alexandre Magno
Argos Tecnologia
Belém(PA) - Brasil


Em Ter, 2003-09-02 às 06:25, cwkuok escreveu:
> hi,
>
> any one know how to retrieve the metadata showing the constraint
> field that belongs to one table
> e.g.
> I have table:
>
> Employee
> _______
>
> ID Primary Key
> IC Unique Key
> Age
> Address
> Phone
>
> how to show info e.g.
>
> Field Constraint Type
> _____ ______________
>
> ID Primary Key
> IC Unique Key
>
> ??
> TIA
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>