0
功能sp_helpconstraint可會給我一個表的參考外鍵
參考外鍵SYBASE查詢
例如:sp_helpconstraint可TAB1
FK_TAB1 TAB1外鍵(ID)參考文獻TABREFERENCE(ID)
我正在做一個查詢,在裏面我想知道參考表。
功能sp_helpconstraint可會給我一個表的參考外鍵
參考外鍵SYBASE查詢
例如:sp_helpconstraint可TAB1
FK_TAB1 TAB1外鍵(ID)參考文獻TABREFERENCE(ID)
我正在做一個查詢,在裏面我想知道參考表。
This example from Sybase.com相當照明:
例如,在pubs3的所述store_employees表sp_helpconstraint可輸出類似:
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 by this table: 2
-- Number of references to this table: 1
-- Number of self references to this table: 1
換句話說,store_employees
具有2個外鍵約束:
store
員工工作地點store_employee
表示該人員的經理請注意表格的FK如何指向自己。