0
ALTER TRIGGER [dbo].[trg_EliminoItems]
ON [dbo].[PedidosEncabezado]
INSTEAD OF DELETE
AS
BEGIN
SET NOCOUNT ON;
insert into HistPedidosEncabezado select * from PedidosEncabezado where PedidosID in (select PedidosID from deleted)
insert into HistPedidosItems select * from PedidosItems where PedidosID in (select PedidosID from deleted)
delete from PedidosItems where PedidosID in (select PedidosID from deleted)
delete from PedidosEncabezado where PedidosID in (select PedidosID from deleted)
END
這個轉換的Microsoft SQL Server觸發到SQLite的。
而與此觸發你有什麼問題?該SQLite沒有'SET'語句,或其他? –
我試圖在sqlite中創建相同的sql觸發器,但似乎sqlite不允許在僅在視圖中的表中創建觸發器。是對的嗎? –
根據[文檔](http://www.sqlite.org/lang_createtrigger.html),這是正確的,但只適用於INSTEAD OF觸發器。 –