SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_name = ccu.CONSTRAINT_name WHERE CONSTRAINT_type = 'PRIMARY KEY'>In Oracle, the following SQL will return a cursor of tables and what columns are indexed as the Primary Key for each table. What SQL will return the same for SQL Server? TIA!
>select > B.Constraint_Type, > A.Index_Name, > A.Table_Name, > A.Column_Name > from > User_Constraints B, User_Ind_Columns A > where A.Index_Name = B.Constraint_Name > and B.ConstraintType = 'P' > order by A.Table_Name