Solved

SQL SERVER 2008 sp_send_dbmail sending out duplicate emails

Posted on 2012-03-21
3
1,640 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 4 159
Sql query 34 35
SQL Stored Procedure insert running but not inserting record 40 61
Using CTE to insert records into a table 2 28
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now