Cascade Delete Trigger Problem

Category: MS-SQL Server -> Applications Author: hotwhb07 Date: 2001-07-08 20:37:29
 
hotwhb07
2001-07-08 20:37:29
Three tables UserInfo store basic information about major relevant personnel field ID ID number, specialize professionals, including a person may have more than one specialty, separated by commas.
Thus, another table will build a multi-specialty store multiple lines. A multi-professional table, ID, and there is a professional two
table statistical tables, the number of information for the UserInfo table and multi-disciplinary combination number.
UserInfo have delete triggers, trigger delete from multi-disciplinary where ID =''
and reduce the number of statistical tables. Multi-disciplinary table also has a delete trigger, delete the data in the tables to reduce delete multiple professional
separate table, the trigger can perform, UserInfo table does not trigger a cascade delete trigger multi-disciplinary table, Please expert guidance
achen1102
2001-07-08 20:45:40
 , , . 。
, ?


Posting Notes

yuer_lucky
2001-07-08 21:03:07
Dingding big turtle.
boss ah, year-end bonuses are not ah.

landlord, the table structure, a list of what relationship, analyze specific issues ah.
manp80
2001-07-08 21:24:33
Triggers for table

If you query this table is a union as a condition to delete the data in another table is not triggered.

cxxx258282702
2001-07-08 21:58:54

delete this directly, theoretically trigger is a certain trigger.
qq285309821
2001-07-08 22:19:32
UserInfo table does not trigger a cascade delete trigger multi-disciplinary table?

you this is how to delete cascading deletes way?
woyaowohaiyao
2001-07-08 22:57:17
UserInfo the trigger
CREATE TRIGGER Trig_delete_comtogather
 ON dbo.UserInfo 
FOR DELETE 
AS

declare @remark varchar(10)
declare @cid int
declare @spec varchar(10)
declare @pid varchar(18)
--------- ----------------------------------
declare Cursor_delete_UserInfo cursor
 for select I_specialize,I_remark,I_company, I_Pid  from Deleted
--------- ---------------------------------
open  Cursor_delete_UserInfo 
--------- -----------------
fetch next from Cursor_delete_UserInfo 
--------- , , ---------------
into @spec,@remark,@cid,@pid
while @@fetch_status=0
begin
if (len( @spec)<3 )
begin
--
end
else
delete from MoreSpecialize where [email protected]
--------- -----------------
fetch next from Cursor_delete_UserInfo 
--------- , , ---------------
into @spec,@remark,@cid,@pid
end
------------------- ---------------------
close Cursor_delete_UserInfo
------------------- ---------------------
deallocate Cursor_delete_UserInfo
qq133664422
2001-07-08 23:25:31
multi-disciplinary triggers in

CREATE TRIGGER Trig_delete_ComTog_fromMore
ON [dbo].[MoreSpecialize] 
after DELETE 
AS

declare @remark varchar(10)
declare @cid int
declare @spec varchar(10)
declare @mid varchar(18)
--------- ----------------------------------
declare Cursor_delete_MoreSpecialize cursor
 for select M_specialize,M_remark, M_id from Deleted
--------- ---------------------------------
open   Cursor_delete_MoreSpecialize
fetch next from  Cursor_delete_MoreSpecialize 
into @spec,@remark,@mid

while @@fetch_status=0
begin
update CompanyTogather set G_reRegister=G_reRegister-1  where [email protected] and [email protected]

fetch next from  Cursor_delete_MoreSpecialize into  @spec,@remark,@mid
szw1987
2001-07-08 23:56:28
UserInfo in
delete from MoreSpecialize where M_id = @ pid
delete multiple professional data in the table
franze
2001-07-09 00:30:17
directly in the program to delete a multi-disciplinary Thank you
table data table does not establish another relationship