What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

June 2015 Entries

Get a list of all columns that participate in Foreign Key relationships
The following query returns all the column information for columns in the specified table that participate in a FK relationship. You can modify the query to return PK information by changing the constriant_type filter. select * from information_schema.columns where table_name = <TableName> AND table_schema=<Schema>and column_name not in (SELECT Col.Column_Name from INFORMATION_SCHEMA.TABLE_CO... Tab, INFORMATION_SCHEMA.CONSTRAI... Col WHERE Col.Constraint_Name = Tab.Constraint_Name ......

Posted On Thursday, June 25, 2015 6:20 PM | Comments (1) | Filed Under [ SQL ]

Powered by: