Subject Re: How to find out the primary key field of a table
Author alanpltse
Hi,

I got empty record set by executing the code in the link:

SELECT RC.RDB$CONSTRAINT_NAME AS CONSTRAINT_NAME,
I.RDB$RELATION_NAME AS TABLE_NAME,
S.RDB$FIELD_NAME AS COLUMN_NAME
FROM RDB$RELATION_CONSTRAINTS RC
LEFT JOIN RDB$INDICES I ON
(I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
LEFT JOIN RDB$INDEX_SEGMENTS S ON
(S.RDB$INDEX_NAME = I.RDB$INDEX_NAME)
WHERE (RC.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY')
AND (I.RDB$RELATION_NAME = 'USERS')

What is the 'USERS'?
In addition, how do I find out primary key field of a particular table ?


--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> --- In firebird-support@yahoogroups.com, "alanpltse" <alanpltse@>
> wrote:
> >
> > Is there a generic way to find out the primary key field of a table?
> > eg
> > SELECT [...]
> > FROM [tablename]
> >
> http://fbtalk.net/viewtopic.php?id=214
>
> Adam
>