开发者

SQL command to show if table is set to cascade on delete

开发者 https://www.devze.com 2023-04-02 01:22 出处:网络
I need to delete some SQL Azure database entries, and I\'m not sure if the casca开发者_如何转开发de on delete is specified or not. If I by accident delete something important, I\'m in a world of hurt.

I need to delete some SQL Azure database entries, and I'm not sure if the casca开发者_如何转开发de 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?


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

0=CASCADE
1=NO ACTION

An example:

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

精彩评论

暂无评论...
验证码 换一张
取 消