关于MSSQL级联删除的问题,急急急!!!!!!!!!!(200分)

  • 主题发起人 主题发起人 ander5115
  • 开始时间 开始时间
A

ander5115

Unregistered / Unconfirmed
GUEST, unregistred user!
我可以定义两个级联删除关系的表<br>CREATE TABLE Type (<br>&nbsp; &nbsp; &nbsp; &nbsp; ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char(20) NOT NULL,<br>&nbsp; &nbsp; &nbsp; &nbsp; Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char(40) NOT NULL,<br>&nbsp; &nbsp; &nbsp; &nbsp; PRIMARY KEY NONCLUSTERED (ID)<br>&nbsp;)<br>&nbsp;<br>&nbsp;CREATE TABLE Field (<br>&nbsp; &nbsp; &nbsp; &nbsp; ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char(20) NOT NULL,<br>&nbsp; &nbsp; &nbsp; &nbsp; FD_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char(18) NOT NULL,<br>&nbsp; &nbsp; &nbsp; &nbsp; PRIMARY KEY NONCLUSTERED (ID, FD_NAME), <br>&nbsp; &nbsp; &nbsp; &nbsp; FOREIGN KEY (ID) REFERENCES Type ON DELETE CASCADE<br>&nbsp;)<br><br>也知道增加级联关系Alter table Field add foreign key(ID) REFERENCES Type ON DELETE CASCADE<br><br>现在的问题是,怎在关系设定之后用SQL语句来修改或删除关系,就是说把不是级联删除的修改为级联删除,或把是级联删除的修改为不是级联删除或直接删除这个关系。分少可以再加。<br><br>谢谢。
 
ALTER TABLE dbo.XX<br> DROP CONSTRAINT FK_XX_DD<br><br>至一修改,你可以先删除再建立<br><br>在企业管理器中删除级联关系,先用profiler追踪它用了什么语句实现!<br><br>这个功能基本万能,让你能知道N多你这不到的密秘!
 
晕死,我跟踪了一下,发现他也是先删除再建立。看来只能用这个方法了。<br>非常感谢。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
628
import
I
I
回复
0
查看
992
import
I
后退
顶部