Learning About Relationships
The following sections describe SQL Server stored procedures that describe relationships between tables.
sp_pkeys
The sp_pkeys stored procedure gives information about a table’s primary key. The following text shows the output of the SQL statement sp_pkeys CustomerOrders. The PK_NAME column is truncated to fit on the page.
TABLE_QUALIFIER TABLE_OWNER TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME =============== =========== ============== =========== ======= ================== OrderEntry dbo CustomerOrders OrderId 1 PK__CustomerOrd...
This output indicates that the CustomerOrders table’s primary key is the single field OrderId. The key’s full name is PK__CustomerOrders__027D5126.
sp_fkeys
The sp_fkeys stored procedure ...
Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.