Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email despatch to sales

Status
Not open for further replies.

clemyp

IS-IT--Management
Dec 13, 2006
18
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top