spTransactions_GetUnprocessedDownloaded
Definition
Copy
CREATE Procedure spTransactions_GetUnprocessedDownloaded
AS
BEGIN
declare @Temp Table(ID int, TransactionID int, TransactionType nvarchar(100))
INSERT INTO @Temp(ID, TransactionID, TransactionType)
select t.ID, TransactionID, TransactionType from dbo.Transactions t
INNER JOIN dbo.SignupTransactions st ON st.SignupTransactionsID = t.TransactionID
WHERE
t.TransactionType = '{5F84002B-ABB1-4f50-A244-D4B14FBB1579}' AND
st.processed_date is NULL AND
st.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
UNION
select t.ID, TransactionID, TransactionType from dbo.transactions t
INNER JOIN dbo.ProfileUpdateTransactions pt ON pt.ProfileUpdateTransactionsID = t.TransactionID
WHERE
t.TransactionType = '{DCEAFCC7-0290-488e-A194-953DE66D6AAB}' AND
pt.processed_date is NULL AND
pt.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
UNION
select t.ID, TransactionID, TransactionType from dbo.transactions t
INNER JOIN dbo.DonationTransactions dt ON dt.DonationTransactionsID = t.TransactionID
WHERE
t.TransactionType = '{5705B543-4033-4a3a-BBCD-A731403EE1E6}' AND
dt.processed_date is NULL AND
dt.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
UNION
select t.ID, TransactionID, TransactionType from dbo.transactions t
INNER JOIN dbo.EventTransactions et ON et.EventTransactionsID = t.TransactionID
WHERE
t.TransactionType = '{172A5D9A-5241-493c-A2C2-EAC164C095B0}' AND
et.processed_date is NULL AND
et.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
UNION
select t.ID, TransactionID, TransactionType from dbo.transactions t
INNER JOIN dbo.MembershipTransactions mt ON mt.ID = t.TransactionID
WHERE
t.TransactionType = '{D7D6143F-823D-4c74-AC2F-947CC96B7008}' AND
mt.processed_date is NULL AND
mt.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
UNION
select t.ID, TransactionID, TransactionType from dbo.transactions t
INNER JOIN dbo.CapWizTransactions ct ON ct.CapWizTransactionsID = t.TransactionID
WHERE
t.TransactionType = '{78902E62-2135-4e3a-A2A1-D92F6E4726D2}' AND
ct.processeddate is NULL AND
ct.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
UNION
select t.ID, TransactionID, TransactionType from dbo.transactions t
INNER JOIN dbo.VolunteerTransactions vt ON vt.ID = t.TransactionID
WHERE
t.TransactionType = '{02B000B6-179F-4c0f-A2DE-6856DCD5D964}' AND
vt.processeddate is NULL AND
vt.IsDeleted = 0 AND
t.BeginDownload is not null AND
t.EndDownload is not null
SELECT * FROM @TEMP
END