Hi there,
can anyone help me with this problem. I have implemented
triggers on a helpdesk system that runs on SQL Server 6.5 to exec a stored
procedure which in turn, calls xp_sendmail. This all works fine when you
test it, but on the live system with several users, things start to hang
after a while. It may be down to my stored procedure or possibly be due to
the Lotus Notes 4.6 (yuk) mail client. Anyway, here is the stored procedure
that I am calling, is there anything in this that looks suspect?
if exists (select * from sysobjects where id = object_id('dbo.SEND_MAIL')
and sysstat & 0xf = 4)
drop procedure dbo.SEND_MAIL
GO
CREATE PROCEDURE SEND_MAIL
AS
-- Select Call details
FROM CALL
-- Select Customer details
FROM CUSPERS
-- Select Call Turnaround Time
FROM SRVTERM
-- Select Call description
FROM CALCDESC
-- Get Call Date/Time
-- Get Scheduled Close Date/Time
-- Declare cursor for call notes
DECLARE CNOTE_LIST CURSOR FOR
SELECT NOTES FROM CALNOTE
ORDER BY SRLNO
-- Remove leading zeros from CALLID
-- Insert record into temporary table
-- get handle to text field
FROM MAILTEXT
BEGIN
CHAR(13)
END
ELSE
BEGIN
CHAR(13)
END
CHAR(13) +
CHAR(13) +
+
'[Call Notes]' + SPACE(18) + ':'
-- Loop round each call note
OPEN CNOTE_LIST
BEGIN
CHAR(13)
FROM CNTNOTES
END
CLOSE CNOTE_LIST
DEALLOCATE CNOTE_LIST
+ CHAR(13) + CHAR(13)
CHAR(13) +
-- Construct mail query string
-- Delete temp table entry
GO