Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
/****** Object: Trigger [scheme].[mihaddcost_ins] Script Date: 06/17/2008 22:25:58 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [scheme].[mihaddcost_ins] ON [scheme].[opdetm] AFTER INSERT AS --Trigger used to modify the driver field in opdetm with costs stored in stockm. --The value entered depends on the currency of the customer. --stockm.setup cost holds the sterling value --stockm.shelf_life holds the euro value INSERT INTO [scheme].[opdetm_cost] SELECT i.order_no , i.order_line_no , CASE WHEN RTRIM(LTRIM(c.currency)) = 'EUR' AND s.shelf_life > 0 THEN s.shelf_life WHEN RTRIM(LTRIM(c.currency)) = 'EUR' AND s.shelf_life = 0 THEN s.standard_cost WHEN RTRIM(LTRIM(c.currency)) = '' AND s.setup_cost =0 THEN s.standard_cost WHEN RTRIM(LTRIM(c.currency)) = '' AND s.setup_cost > 0 THEN s.setup_cost ELSE 0 END * CASE WHEN i.order_line_status ='B' THEN i.order_qty WHEN i.allocated_qty>0 THEN i.allocated_qty WHEN i.despatched_qty>0 THEN i.despatched_qty ELSE i.order_qty END , CASE RTRIM(LTRIM(c.currency)) WHEN 'EUR' THEN i.val/1.27 ELSE i.val END AS STGVAL , o.date_entered , i.line_type , o.territory FROM INSERTED i JOIN [scheme].[opheadm] o ON o.order_no = i.order_no JOIN [scheme].[slcustm] c ON c.customer = o.customer LEFT JOIN [scheme].[stockm] s ON s.[product] = i.product AND s.[warehouse]= i.warehouse
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.