General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only