reference foreign key sybase query -
reference foreign key sybase query -
the function sp_helpconstraint give me reference foreign key of table
example : sp_helpconstraint tab1
fk_tab1 tab1 foreign key (id) references tabreference(id)
i doing query , within of want know reference tables.
this illustration sybase.com quite illuminating:
for example, sp_helpconstraint output on store_employees table in pubs3 looks similar to:
name defn --------------------------- -------------------------------- store_empl_stor_i_272004000 store_employees foreign key (stor_id) references stores(stor_id) store_empl_mgr_id_288004057 store_employees foreign key (mgr_id) self references store_employees(emp_id) store_empl_2560039432 unique index( emp_id) : nonclustered, foreign reference (3 rows affected) total number of referential constraints: 2 details: -- number of references made table: 2 -- number of references table: 1 -- number of self references table: 1 in other words, store_employees has 2 foreign key constraints:
store employee works store_employee indicating person's manager note how table's fk can point @ itself.
sybase
Comments
Post a Comment