well quite a long break, have been bz with day to day schedule. a few days ago, i was looking for a query that will list all the tables ,with their forigen keys, with refered primay key table and column, after looking into the system table , i crafted one myselft ,
select ftable.name as FOREIGN_TABLE, fcol.name as FOREIGN_KEY, ptable.name as PRIMARY_TABLE,pcol.name as PRIMARY_KEY
from sysobjects as ftable ,sysforeignkeys fk ,syscolumns fcol ,sysobjects ptable,syscolumns pcol
sysobjects contains all objects in the database, all tables,all keys, all constrainst, etc,everything is kept here, and issued an id which is refered in other tables.
sysforeignkeys contains forgienKey constraint, and details about the relationn, column id etc,
syscolumns contains details about column of every table ,their names, their data type etc.