Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Show Emails from last 1 days and time to send in min where time to send > 5 min.
- Useful to know if emails may be stuck in a pending send status
- */
- SELECT Subject,
- CASE
- WHEN StatusCode =3 THEN 'Sent'
- END AS 'Status Name'
- ,DeliveryAttempts,CreatedOn,SentOn,DateDiff("mi",CreatedOn,SentOn) AS 'TimeToSend(min)'
- FROM Email (NOLOCK)
- WHERE DirectionCode = 1
- --AND SentOn != null
- --uncomment next line to restrict to only those that take more than 10 min to send
- --AND DateDiff("mi",CreatedOn,SentOn) > 10
- AND StatusCode = 3
- -- Only show emails from last day
- AND CAST(DateDiff("day",CreatedOn,GetDate()) AS INT) <= 1
- --Return emails that took longer than 5 min to send
- AND CAST(DateDiff("mi",CreatedOn,SentOn) AS INT) > 5
- ORDER BY Email.CreatedOn DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement