12 March,2007 by Tom Collins
A Foreign Key Constraint is defined when a table is modified or created. A Foreign Key enforces a relationship between data on two tables.
To list Foreign Key Constraints use this SQL code.
select c_c_u.table_name sr_c_table, c_c_u.constraint_name sr_c_constraint, c_c_u.column_name sr_c_col, k_c_u.table_name target_table, k_c_u.column_name target_col from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE c_c_u, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS r_c, INFORMATION_SCHEMA.KEY_COLUMN_USAGE k_c_u where c_c_u.constraint_name = r_c.constraint_name and k_c_u.constraint_name = r_c.unique_constraint_name order by c_c_u.table_name, c_c_u.constraint_name
SQL server – What is a SQL index key?
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |