Stored Procedure to find Primary keys and foreign keys of a table. | SansSQL

Tuesday, July 8, 2008

Stored Procedure to find Primary keys and foreign keys of a table.

Here are the Stored Procedures to find the Primary keys and Foreign keys of a table.

1. SP to find Primary keys on a particular table

EXEC sp_pkeys 'Table_Name'

2. SP to find Foreign keys on a particular table

EXEC sp_fkeys 'Table_Name'

Ads