Answer:
SELECT COUNT (DISTICT constraint_name)
FROM apd_schema.constraint_column_usage
RUN
Explanation:
General syntax to return a catalog view of information about foreign keys.
SELECT DISTINCT PARENT_TABLE =
RIGHT(Replace(DC.constraint_name, 'fkeys_', ''),
Len(Replace(DC.constraint_name, 'fkeys_', '')) - Charindex('_', Replace(DC.constraint_name, 'fkeys_', ''))),
CHILD_TABLE = DC.table_name,
CCU.column_name,
DC.constraint_name,
DC.constraint_type
FROM apd_schema.table_constraints DC
INNER JOIN apd_schema.constraint_column_usage CCU
ON DC.constraint_name = CCU.constraint_name
WHERE DC.constraint_type LIKE '%foreign'
OR DC.constraint_type LIKE '%foreign%'
OR DC.constraint_type LIKE 'foreign%'
RUN