Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to retrieve the table's Unique Constraint from FireB
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Database:
Firebird
Divers
Thread ID:
01266183
Message ID:
01268731
Vues:
16
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
___________________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform