Subject | Re: [IBO] Dinamically discover primary key name |
---|---|
Author | Ramil |
Post date | 2006-07-03T05:00:10Z |
1. KeyFields property of dataset.
2. SQL query for all Tables:
SELECT I.RDB$RELATION_NAME, S.RDB$FIELD_NAME
FROM RDB$RELATION_CONSTRAINTS C,
RDB$INDICES I,
RDB$INDEX_SEGMENTS S
WHERE RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY 1,2;
You can change this query for the necessary table only.
Best regards,
Ramil
2. SQL query for all Tables:
SELECT I.RDB$RELATION_NAME, S.RDB$FIELD_NAME
FROM RDB$RELATION_CONSTRAINTS C,
RDB$INDICES I,
RDB$INDEX_SEGMENTS S
WHERE RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
AND C.RDB$RELATION_NAME = I.RDB$RELATION_NAME
AND C.RDB$INDEX_NAME = I.RDB$INDEX_NAME
AND I.RDB$INDEX_NAME = S.RDB$INDEX_NAME
ORDER BY 1,2;
You can change this query for the necessary table only.
Best regards,
Ramil
>
>
>
>
>
> Hi guys. Does anyone knows if there are any way to dinamically
> discover the primary key name of any table with ibo? Thanks in advance
> for all help.
>
>
>
>
>