Blimey, the syntax is significantly different - considering they both came from the same stable.I think the only question I can answer (and badly at that!) is the ORDER 3 one.MSSQL doesn't have any ordering of triggers, except that you can specify the FIRST and LAST to execute with sp_settriggerorder.I'll have a go at the Trigger too:The TRIGGER looks as though it processes each row separately, which is not how MSSQL works (it processes them as a set, unless you use CURSOR or somesuch). Thus I would imageine your can replace:if (inserted.prSlot < deleted.productSlot)begindelete from SlotBank where (SlotBank.product = inserted.productId) and(SlotBank.slotNum > inserted.slotProduct)end
withdelete SBfrom SlotBank SB JOIN inserted ON inserted.PK = SB.PK JOIN deleted ON deleted.PK = SB.PKwhere (SlotBank.product = inserted.productId) and (SlotBank.slotNum > inserted.slotProduct) AND (inserted.prSlot < deleted.productSlot)
and replacedeclare @prodId intset @proId = inserted.productIdset @i = deleted.productSlotwhile (@i <= inserted.productSlot)insert into SlotBank(slotProduct, slotNum) values(@proId,@i)set @i = @i + 1
withinsert into SlotBank(slotProduct, slotNum)SELECT inserted.productId, deleted.productSlotfrom SlotBank SB JOIN inserted ON inserted.PK = SB.PK JOIN deleted ON deleted.PK = SB.PKWHERE inserted.prSlot >= deleted.productSlot OR inserted.prSlot IS NULL -- May be irrelevant OR deleted.prSlot IS NULL -- ditto
Kristen