Top 200 Donors with Email¶
This report returns the top donors for the current year and the report includes the person’s email address. It actually will include both spouses if they give jointly and will include both email addresses in that case.
Notice the top Declare statements. This is where you can change the Start Date, add an End Date by replacing GETDATE() with the date you want, putting it in the same format as the Start Date, or specify a Campus ID# - replace NULL with the ID# for the Campus. Example: ‘2’
The default as you see below starts with the first of the year (you will need to change that at the start of each year) and will run through the current (today’s) date. It will look at givers from all campuses.
Of course, if you want to return a different number of donors just change the 200 in the SELECT TOP 200 statement to whatever number of donors you want returned.
This report is protected by the user role Finance.
Use the following code to Create the SQL Script. See How to create a SQL Script. The suggested name of the report is Top200DonorsWithEmailAddress.
--roles=Finance DECLARE @StartDate DATETIME = '1/1/17' DECLARE @EndDate DATETIME = GETDATE() DECLARE @CampusId INT = NULL SELECT TOP 200 CreditGiverId , CreditGiverId2 , HeadName , SpouseName , Count , Amount , MainFellowship , MemberStatus , d.JoinDate , d.SpouseId , [Option] , HOHEmail = p.EmailAddress, SpouseEmail = p2.EmailAddress, Addr , Addr2 , City , ST , Zip FROM GetTotalContributionsDonor(@StartDate, @EndDate, @CampusId, 0, 1, NULL, NULL, NULL, NULL) d JOIN dbo.People p ON p.PeopleId = d.CreditGiverId LEFT JOIN dbo.People p2 ON p2.PeopleId = d.CreditGiverId2 ORDER BY d.Amount DESC
Add additional NULL parameter to GetTotalContributionsDonor function.