SQL to show if the table is cascaded when deleted

I need to delete some Azure SQL database records and I'm not sure if the cascade on delete option is specified or not. If I accidentally delete something important, I'm terrified. So, is there a command to check for cascade deletion?

+4
source share
1 answer

Use sp_fkeys to find it. http://msdn.microsoft.com/en-us/library/ms175090.aspx Look at the DELETE_RULE result column.

 0=CASCADE 1=NO ACTION 

Example:

 USE MyDB; GO EXEC sp_fkeys @pktable_name = N'MyTable',@pktable_owner = N'MyUserName'; 
+3
source

All Articles