Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to retrieve the table's Unique Constraint from FireB
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Firebird
Miscellaneous
Thread ID:
01266183
Message ID:
01266210
Views:
21
This message has been marked as the solution to the initial question of the thread.
Might this be what you're after?

FUNCTION GETPRIMARYKEY(lcSQLTable)
*--Passed the name of a Firebird table, returns its primary key
*--Assumes giHandle contains previously-established connection handle
LOCAL lcSQL
TEXT TO lcSQL NOSHOW PRETEXT 15
SELECT RDB$FIELD_NAME AS COLUMN_NAME
FROM RDB$INDEX_SEGMENTS I
INNER JOIN RDB$RELATION_CONSTRAINTS C
ON C.RDB$INDEX_NAME=I.RDB$INDEX_NAME
WHERE RDB$CONSTRAINT_TYPE='PRIMARY KEY' AND
RDB$RELATION_NAME=?m.lcSQLTable
ENDTEXT
SQLEXEC(giHandle,lcSQL)
RETURN COLUMN_NAME
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform