理解关系黑白表 [英] understanding relation b/w tables

查看:88
本文介绍了理解关系黑白表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果项目包含70个表.我如何理解黑白关系
这些表

if project contains 70 tables . how i can understand relationship b/w
those tables

推荐答案

在一个以下使用
Use below one
Select
object_name(rkeyid) Parent_Table,
object_name(fkeyid) Child_Table,
object_name(constid) FKey_Name,
c1.name FKey_Col,
c2.name Ref_KeyCol
From
sys.sysforeignkeys s
Inner join sys.syscolumns c1
on ( s.fkeyid = c1.id And s.fkey = c1.colid )
Inner join syscolumns c2
on ( s.rkeyid = c2.id And s.rkey = c2.colid )
Order by Parent_Table,Child_Table





我测试下面一种工作方式,只需将其粘贴到SQL Server查询窗口中即可.执行



or

I test below one working just paste it in SQL server Query window & execute

select object_name(constid) FKey_Name, object_name(fkeyid) Child_Table, c1.name FKey_Col,
object_name(rkeyid) Parent_Table, c2.name Ref_KeyCol
from sysforeignkeys s
inner join syscolumns c1
on ( s.fkeyid = c1.id
and s.fkey = c1.colid  )
inner join syscolumns c2
on ( s.rkeyid = c2.id
and s.rkey = c2.colid  )













or

Google is your friend
:)


1.如果您是关于数据库级别的关系的,则假设有相关文档,请参见

2.如果您是如何在ADO.NET中的表之间建立关系的,那么请看下面的
示例

编辑

查看一个特定表的主键/索引等的详细信息.在SQL Server中,键入 exec sp_help 表名,其中表名是您想了解的实际表
1. If your on about relationships at a database level, assuming there is a documentation look at that

2. If your after how to make relationships between the tables in ADO.NET then have a look at this example

edit

to look at the details of one particular table primary key / indexes etc. In SQL Server type exec sp_help tablename where tablename is the actual table you want to know more about


在查询窗口中选择表名称,然后按Alt + F1.在那里,您将获得特定表与其他表的关系...
In the query window select table name and press Alt+F1. There u will get relations of the particular table with other table...


这篇关于理解关系黑白表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆