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:
01268731
Views:
15
Hi Jonathan

After a bit of fiddling I developed the following. Please let me know if I am using the wrong system table

SELECT COUNT(RDB$RELATION_NAME) AS TablesCount
FROM RDB$RELATIONS
WHERE RDB$RELATION_NAME = '<>'

>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
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform