用于显示表是否在删除时设置为级联的SQL命令

时间:2021-08-19 23:29:06

I need to delete some SQL Azure database entries, and I'm not sure if the cascade on delete is specified or not. If I by accident delete something important, I'm in a world of hurt. So, is there a command to check for cascade deletion?

我需要删除一些SQL Azure数据库条目,我不确定是否指定了删除级联。如果我偶然删除一些重要的东西,我就处在一个受伤的世界里。那么,是否有检查级联删除的命令?

1 个解决方案

#1


3  

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

使用sp_fkeys查找它。 http://msdn.microsoft.com/en-us/library/ms175090.aspx查看结果集的“DELETE_RULE”列。

0=CASCADE
1=NO ACTION

An example:

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

#1


3  

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

使用sp_fkeys查找它。 http://msdn.microsoft.com/en-us/library/ms175090.aspx查看结果集的“DELETE_RULE”列。

0=CASCADE
1=NO ACTION

An example:

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