Hi All,
I have been working on a process where byt when a Fulfiment Order despatch note is printed the Sales Guys are notified via email, as to what exactly has been shipped out.
I have played around with a trigger to write to a table, I will then poll this table every 5 mins for data, if data is found I then email to the sales guys in question.
my problem is my trigger write twive to the table??
this is my code below, thanks Paul
USE [JDD]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER TRIGGER [dbo].[EMAIL_SALES_DESPATCHED] ON [dbo].[SOP10100]
FOR UPDATE
AS
SET NOCOUNT ON
DECLARE
@SOPNUMBE VARCHAR(21)
SET @SOPNUMBE=(SELECT SOPNUMBE FROM INSERTED)
insert into temp_Email_Despatch_orders_Info
select INS.SOPNUMBE,
INS.SOPTYPE,
INS.ORIGNUMB,
INS.CUSTNMBR,
INS.SLPRSNID,
LINE.ITEMNMBR,
LINE.QUANTITY,
LINE.ITEMDESC,
LINE.UNITPRCE,
LINE.XTNDPRCE
from inserted as INS
inner join SOP10200 as LINE
on INS.SOPNUMBE = LINE.SOPNUMBE
where INS.SOPTYPE=6 AND INS.SOPSTATUS=6 and INS.SOPNUMBE=@SOPNUMBE
I have been working on a process where byt when a Fulfiment Order despatch note is printed the Sales Guys are notified via email, as to what exactly has been shipped out.
I have played around with a trigger to write to a table, I will then poll this table every 5 mins for data, if data is found I then email to the sales guys in question.
my problem is my trigger write twive to the table??
this is my code below, thanks Paul
USE [JDD]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER TRIGGER [dbo].[EMAIL_SALES_DESPATCHED] ON [dbo].[SOP10100]
FOR UPDATE
AS
SET NOCOUNT ON
DECLARE
@SOPNUMBE VARCHAR(21)
SET @SOPNUMBE=(SELECT SOPNUMBE FROM INSERTED)
insert into temp_Email_Despatch_orders_Info
select INS.SOPNUMBE,
INS.SOPTYPE,
INS.ORIGNUMB,
INS.CUSTNMBR,
INS.SLPRSNID,
LINE.ITEMNMBR,
LINE.QUANTITY,
LINE.ITEMDESC,
LINE.UNITPRCE,
LINE.XTNDPRCE
from inserted as INS
inner join SOP10200 as LINE
on INS.SOPNUMBE = LINE.SOPNUMBE
where INS.SOPTYPE=6 AND INS.SOPSTATUS=6 and INS.SOPNUMBE=@SOPNUMBE