简体   繁体   English

SQL服务器管理系统中如何查看所有外键和主键

[英]How do I see all foreign keys and primary keys in SQL Server Management System

In SQL Server Management System, how do I get a list of all foreign key constraints pointing to a particular table?在 SQL 服务器管理系统中,如何获取指向特定表的所有外键约束的列表? a particular column?特定的列? This is the same thing as this Oracle question, but for SQL Server Management System.这与此 Oracle 问题相同,但针对 SQL 服务器管理系统。

Also How do I see all primary keys of all tables.另外我如何查看所有表的所有主键。

You can use following您可以使用以下

EXEC sp_fkeys 'yourTableName'

You can select the tablename in the query in management studio and press ALT+F1 then it display all keys and index on that table您可以 select 在管理工作室查询中的表名并按 ALT+F1 然后它显示该表上的所有键和索引

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM