无法使用触发器删除记录

时间:2019-03-24 14:54:32

标签: sql-server sql-server-2008

当我从一个表中删除某些数据时,我尝试从其中删除一些数据,但是我不明白这是怎么回事。 所以我用了扳机,这是可行的:

ALTER TRIGGER [dbo].[deleteBankAccount]
ON [dbo].[Clinic]
AFTER DELETE
AS
BEGIN

   DELETE FROM Bank_account WHERE number_bank_account = (SELECT TOP 1 number_bank_account FROM DELETED)

END

此触发器具有几乎相同的代码,仅是问题所在。

DELETE FROM Clinic WHERE Clinic_name = 'Clover'

冲突发生在...表“ dbo.Dogovor”的“法律地址诊所”列中。

ALTER TRIGGER [dbo].[DeleteDogovor]
ON [dbo].[Clinic]
AFTER DELETE
AS
BEGIN

   DELETE FROM Dogovor WHERE Legal_address_Clinic = (SELECT TOP 1 Legal_address_Clinic FROM DELETED)

END

HowItLooks

0 个答案:

没有答案