Saya memiliki tampilan yang dipartisi yang memiliki pemicu sisipan di bawah ini (partisi mans buruk). Ketika saya melakukan HAPUS, saya mendapatkan paket permintaan di bawah ini:
delete from factproductprice where pricedate = '20170725'
Pemicu pada tampilan:
ALTER TRIGGER [dbo].[factProductPriceDelete] ON [dbo].[FactProductPrice]
INSTEAD OF DELETE AS
BEGIN
IF @@ROWCOUNT = 0 RETURN;
DECLARE @PriceDate DATE
SELECT @PriceDate = CAST(PriceDate AS DATE) FROM DELETED
IF @PriceDate BETWEEN '20140101' AND '20141231'
BEGIN
DELETE FROM dbo.FactProductPrice2014
WHERE ProductId IN (SELECT ProductId FROM DELETED) AND SalesPriceSchemeId IN (SELECT SalesPriceSchemeId FROM DELETED) AND PriceDate IN (SELECT PriceDate FROM DELETED)
END
IF @PriceDate BETWEEN '20150101' AND '20151231'
BEGIN
DELETE FROM dbo.FactProductPrice2015
WHERE ProductId IN (SELECT ProductId FROM DELETED) AND SalesPriceSchemeId IN (SELECT SalesPriceSchemeId FROM DELETED) AND PriceDate IN (SELECT PriceDate FROM DELETED)
END
IF @PriceDate BETWEEN '20160101' AND '20161231'
.... dll