USE [ck] GO /****** Object: Trigger [dbo].[ordine_add_info] Script Date: 08/22/2014 18:14:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER trigger [dbo].[ordine_add_info] on [dbo].[Ordine_list] after insert as if exists(select 1 from inserted where prezzo =0) update ordine_list set ordine_list.Descrizione=magazzino.Descrizione,ordine_list.prezzo=magazzino.Prezzo,ordine_list.Articolo=magazzino.Articolo from magazzino,inserted where ordine_list.id=inserted.id and ordine_list.Date=inserted.date and magazzino.id=inserted.id
为什么明明PREZZ<>0下面的更新语句还是执行看是修改后等于0还是修改前等于0 如果是修改前: if exists(select 1 from deleted where prezzo =0)
GO
/****** Object: Trigger [dbo].[ordine_add_info] Script Date: 08/22/2014 18:14:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER trigger [dbo].[ordine_add_info]
on [dbo].[Ordine_list]
after insert
as
if exists(select 1 from inserted where prezzo =0)
update ordine_list set ordine_list.Descrizione=magazzino.Descrizione,ordine_list.prezzo=magazzino.Prezzo,ordine_list.Articolo=magazzino.Articolo
from magazzino,inserted
where ordine_list.id=inserted.id and ordine_list.Date=inserted.date and magazzino.id=inserted.id
如果是修改前:
if exists(select 1 from deleted where prezzo =0)