1. 程式人生 > >檢視SqlServer2000的外來鍵列表

檢視SqlServer2000的外來鍵列表

select object_name(a.constid) fkname,
object_name(a.rkeyid) pktable,
object_name(a.fkeyid) rktable,
c.name pkcolumn,
b.name fkcolumn,
OBJECTPROPERTY( constid, N'CnstIsDeleteCascade') DeleteCascade,
OBJECTPROPERTY( constid, N'CnstIsUpdateCascade') UpdateCascade
from sysforeignkeys a
left outer join syscolumns b on a.fkeyid=b.id and a.fkey=b.colid
left outer join syscolumns c on a.rkeyid=c.id and a.rkey=c.colid