|
From: laredotornado on 2 Apr 2008 10:42 Hi, How can I run a query to figure out what tables and corresponding columns link to any column in my table T? Thanks, - Dave
From: Bill E. on 2 Apr 2008 15:50 Try SELECT obj.name AS ChildTable, col.name AS ChildColumn, obj2.name AS ParentTable, col2.name AS ParentColumn FROM sysforeignkeys fk JOIN syscolumns col on col.id= fk.fkeyid and col.colid= fk.fkey JOIN syscolumns col2 on col2.id=fk.rkeyid and col2.colid= fk.rkey JOIN sysobjects obj on col.id=obj.id JOIN sysobjects obj2 on col2.id=obj2.id This will give you all of the foreign key relationships. Add a WHERE clause to narrow it down to one table. Bill E. Hollywood, FL
|
Pages: 1 Prev: [IAT ELEZIONI] Presentazione candidati Next: tempdb size question |