cookieChoices = {};

Wednesday, 4 May 2016

List of Primary Key and Foreign Key for a particular table

List of Primary Key and Foreign Key for a particular table


SELECT  
  
DISTINCT  
  
Constraint_Name AS [Constraint],  
  
Table_Schema AS [Schema],  
  
Table_Name AS [TableName] FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE  
  
WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME='Table_Name'  
  
GO  

No comments:

Post a Comment