SHARE
TWEET

Untitled

a guest May 23rd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BEGIN TRANSACTION
  2. SET QUOTED_IDENTIFIER ON
  3. SET ARITHABORT ON
  4. SET NUMERIC_ROUNDABORT OFF
  5. SET CONCAT_NULL_YIELDS_NULL ON
  6. SET ANSI_NULLS ON
  7. SET ANSI_PADDING ON
  8. SET ANSI_WARNINGS ON
  9. COMMIT
  10. BEGIN TRANSACTION
  11. GO
  12.  
  13. ALTER VIEW [dbo].[EmailSummaryView]
  14. AS
  15. SELECT        dbo.Emails.ID, dbo.Emails.Name, dbo.Emails.Subject, dbo.Emails.CreatedBy, dbo.Emails.CompanyID, dbo.Emails.SentOn, dbo.Emails.OpenRate, dbo.Emails.Status,
  16.                          dbo.Emails.TotalSent, dbo.Emails.TotalOpened, dbo.Emails.TotalBounced, dbo.Emails.TotalClicked, dbo.Users.Name AS UserName, dbo.Users.Email,
  17.                          dbo.Users.FirstName, dbo.Users.LastName, dbo.Users.CompanyName, dbo.Users.CompanyID AS UserCompanyID,
  18.                          (case when dbo.Emails.OnBehalfOfUser = '-1' then  'Owners'
  19.                          when dbo.Emails.OnBehalfOfUser = '-2' then  'Creators'
  20.                          when dbo.Emails.OnBehalfOfUser is not null then (select Email from Users where ID = dbo.Emails.OnBehalfOfUser)
  21.                          else 'Self' end ) as OnBehalf
  22. FROM            dbo.Emails INNER JOIN
  23.                          dbo.Users ON dbo.Emails.CreatedBy = dbo.Users.ID
  24. WHERE        (dbo.Emails.Status = 1) AND (dbo.Users.Status = 1)
  25.  
  26. GO
  27. COMMIT
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top