Subject | RE: [firebird-support] Re: How to find out the primary key field of a table |
---|---|
Author | Nigel Weeks |
Post date | 2006-06-23T00:59:20Z |
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 ?
'USERS' is the table you want to find the primary key for...
So, to find pkeys on the table 'BLAH', change 'USERS' to 'BLAH'
N
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 ?
'USERS' is the table you want to find the primary key for...
So, to find pkeys on the table 'BLAH', change 'USERS' to 'BLAH'
N