Solved

SQL SERVER 2008 sp_send_dbmail sending out duplicate emails

Posted on 2012-03-21
3
1,654 Views
Last Modified: 2012-08-27
I have a stored procedure that executes sp_send_dbmail to a variety of recipients.  It is scheduled to run at 4:00 AM and it successfully emails the text.  However, it duplicates the email and sends it EXACTLY 1 minute later.  The text in the email comes from a stored procedure but this stored procedure only runs a SELECT query (cursor).

Can someone help me figure out why this is duplicating the emails?  We recently upgraded to MS Exchange 2010.   I already looked at the advanced settings for the task and the retry attempts and retry interval are both set to zero (I seen that fixed the issue for someone else).

Thanks for the help.
0
Comment
Question by:PACCAST-DEV
3 Comments
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 37749862
You should trace the stored proc in my opinion to see if it is called more than once - use SQL profiler for that, and also check your set mail items in SQL by running query below to see if indeed duplicate mail was sent out:

select * from msdb..sysmail_sentitems order by sent_date desc
0
 

Author Closing Comment

by:PACCAST-DEV
ID: 37781946
Very helpful and tracked it down
0
 

Expert Comment

by:lhcit
ID: 38337378
What did you find it was doing?  I am having the same issue - I am going to start up sql profile and dig more, but thought I would check here too.  I see it in sysmail_mailitems with a status = 2 (failed), and I only see 1 record, but still receive the email twice, 1 minute apart.

Thanks!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can I convert a numeric string into referenced values with an SQL query? 10 41
Generate Scripts of Schema/Data with "WHERE" clause 6 64
SQL Help 27 46
While in ##Table - Help 4 16
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question