2013-06-04 85 views
0

我想延長我的查詢進行刪除和更新規則,但我只是想不出什麼SYSTABLE是在什麼樣的列檢查外鍵

我查詢至今:

select oct.name FKNeve,oft.name TAmit,ofc.name MAmit,ort.name TAmihez,orc.name MAmihez 
from sysforeignkeys sfk 
inner join sysobjects oct on sfk.constid = oct.id 
inner join sysobjects oft on sfk.fkeyid = oft.id 
inner join syscolumns ofc on sfk.fkey = ofc.colid and sfk.fkeyid = ofc.id 
inner join sysobjects ort on sfk.rkeyid = ort.id 
inner join syscolumns orc on sfk.rkey = orc.colid and sfk.rkeyid = orc.id 

哦和MSDE。

回答

1

使用OBJECTPROPERTY函數(將'CnstIsDeleteCascade'/'CnstIsUpdateCascade'作爲第二個參數)。

+0

似乎工作。我修改了上面幾行...... select oct.name FKNeve,oft.name TAmit,ofc.name MAmit,ort.name TAmihez,orc.name MAmihez,objectproperty(sfk.constid,'CnstIsDeleteCascade'),objectproperty(sfk.constid ,'CnstIsUpdateCascade')...這正是我想要的。感謝您的幫助! –