Posted By

marcocs on 08/19/09


Tagged

admin Mantenimiento


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

sulfurito
Tyster


Foreign Key with Action


 / Published in: SQL
 

Foreign Key with actions on delete or update.

  1. SELECT f.name AS foreign_key_name ,
  2. OBJECT_NAME(f.parent_object_id) AS table_name ,
  3. COL_NAME(fc.parent_object_id, fc.parent_column_id) AS constraint_column_name ,
  4. OBJECT_NAME(f.referenced_object_id) AS referenced_object ,
  5. COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS referenced_column_name ,
  6. delete_referential_action_desc ,
  7. update_referential_action_desc
  8. FROM sys.foreign_keys AS f
  9. INNER JOIN sys.foreign_key_columns AS fc ON f.object_id = fc.constraint_object_id
  10. WHERE (delete_referential_action_desc <> 'NO_ACTION'
  11. OR update_referential_action_desc <> 'NO_ACTION') AND is_disabled=0

Report this snippet  

You need to login to post a comment.