![]() Where r.Referenced_Column_Name = f.referencing_column_Nameįollowing query is also useful to see all Paren-Child key Relationship with table Names & Column Names: Where (f.fkeyid = o.id) and c.id = o.id and c.colid = f.fkey) f (select referencing_column_Name = c.name, Referencing_Object_name = o.name, f.constid from sysforeignkeys f, sysobjects o, syscolumns c Where (f.rkeyid = o.id) and c.id = o.id and c.colid = f.rkey) r, (select Referenced_Column_Name = c.name, Referenced_Object_name = o.name, f.constid from sysforeignkeys f, sysobjects o, syscolumns c Select Referencing_Object_name, referencing_column_Name, Referenced_Object_name, Referenced_Column_Name from OBJECT_NAME(parent_object_id) AS TableName, ![]() SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint, ![]() This is simple but useful script from my personal archive. I use this many times to check the foreign key and primary key constraint in database. Following script are very useful to know all the constraint in the database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |