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:
01266337
Views:
9
Hi Jonathan

>Might this be what you're after?

Almost, see changes below
lcSQLTable = "MACCOUNTS"
*--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='UNIQUE' AND
               RDB$RELATION_NAME=?m.lcSQLTable
ENDTEXT
SQLEXEC(giHandle,lcSQL)
This will return the cursor containing all fields involved in the UNIQUE constraints. Thanks, without your help I would not know how to go about it.
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