Finding the Primary and foreign keys of the table in Sql

We have some ways to find the primary and foreign key information in Sql. Some of those are,

1.sp_help table name
                         This will provide all the information about the specific table such as column names,constraints and so on.
(e.g)
sp_help eistmuser

output

2.sp_pkeys table name

                                  This will return only the primary key details of the specific table.

(e.g)
sp_pkeys eistmuser

output 




3.sp_fkeys table name
                                         
                                    This will return only the foreign key details of the specific table.
(e.g)
sp_fkeys eistmuser

output



I hope this will be helpful for you .

Comments

Popular posts from this blog

Types of Architects

Basic measurements

Search html table contents based on its td using Jquery