Skip to content

Instantly share code, notes, and snippets.

@avisser
Created March 22, 2016 18:44
Show Gist options
  • Save avisser/76b9975c7ec557435201 to your computer and use it in GitHub Desktop.
Save avisser/76b9975c7ec557435201 to your computer and use it in GitHub Desktop.
CREATE VIEW [dbo].[vInteractionScranton]
AS
SELECT InteractionTable.InteractionScrantonID, InteractionTable.EntityID, InteractionTable.GrpID, dbo.Grp.Grp, InteractionTable.ContactName, InteractionTable.InteractionDate,
InteractionTable.TacticID, dbo.Tactic.Tactic, InteractionTable.ResponseTypeID, dbo.ResponseType.ResponseType, InteractionTable.CallDispositionID,
dbo.CallDisposition.CallDisposition, InteractionTable.Note, InteractionTable.EmailRead, InteractionTable.CampaignRemovalReasonID,
InteractionTable.NoInterestReasonID, InteractionTable.LeadTypeID, InteractionTable.PurchaseTimeFrame, InteractionTable.FollowUpActionID,
InteractionTable.SizeOfOpportunity, InteractionTable.DiscussionTopicID, dbo.DiscussionTopic.DiscussionTopic, InteractionTable.NoContactReasonID,
dbo.NoContactReason.NoContactReason, InteractionTable.SpokenToID, dbo.SpokenTo.SpokenTo, InteractionTable.NotVerifiedID, dbo.NotVerified.NotVerified,
InteractionTable.CampaignID, Campaign.CampaignDesc, InteractionTable.DPCampaignStepDetailID, InteractionTable.CampaignDispositionID,
dbo.CampaignDisposition.CampaignDisposition, InteractionTable.DPCampagnEnrollmentBatch, InteractionTable.ResponseID, InteractionTable.SQLMAIL,
InteractionTable.CallTypeID, dbo.CallType.CallType, InteractionTable.CallDurationID, dbo.CallDuration.CallDuration, InteractionTable.CallStatusID,
dbo.CallStatus.CallStatus, InteractionTable.StatusDate, InteractionTable.OpenDate, InteractionTable.ConKey, InteractionTable.NumberOfTiersScrantonID,
dbo.NumberOfTiersScranton.NumberOfTiersScranton, InteractionTable.LockerLocationTypeScrantonID, dbo.LockerLocationTypeScranton.LockerLocationTypeScranton,
InteractionTable.EstimatedNumberOfLockers, InteractionTable.ActualNumberOfLockers, InteractionTable.ProjectFundSourceScrantonID,
dbo.ProjectFundSourceScranton.ProjectFundSourceScranton, InteractionTable.EstimatedInstallDate, InteractionTable.ProjectDecisionMakingProcessScrantonID,
dbo.ProjectDecisionMakingProcessScranton.ProjectDecisionMakingProcessScranton, InteractionTable.ConfirmInstallDate, InteractionTable.ProductType1ScrantonID,
ProductType1Scranton.ProductType AS ProductType1Scranton, InteractionTable.ProductType2ScrantonID,
ProductType2Scranton.ProductType AS ProductType2Scranton, InteractionTable.ProductType3ScrantonID,
ProductType3Scranton.ProductType AS ProductType3Scranton, InteractionTable.DodgeProjectID, InteractionTable.EstimatedNumberOfPartitions,
InteractionTable.ActualNumberOfPartitions, InteractionTable.MyParentID, InteractionTable.MyParentEntityID, InteractionTable.Created, InteractionTable.CreatedBy,
InteractionTable.LastRevised, InteractionTable.LastRevisedBy, InteractionTable.Inserted, InteractionTable.Updated, InteractionTable.InsertedBy,
InteractionTable.UpdatedBy, InteractionTable.EditCount, dbo.DRProjectScranton.DodgeReportNumber, dbo.DRProjectScranton.ProjectTitle,
dbo.DRProjectScranton.City, dbo.DRProjectScranton.State, dbo.DRProjectScranton.ProjectStatus, dbo.LeadType.LeadType, dbo.FollowUpAction.FollowUpAction,
dbo.NoInterestReason.NoInterestReason, InteractionTable.Reference1, InteractionTable.Reference2, InteractionTable.Reference3,
dbo.CampaignRemovalReason.CampaignRemovalReason
FROM dbo.InteractionScranton AS InteractionTable INNER JOIN
dbo.Grp ON InteractionTable.GrpID = dbo.Grp.GrpID LEFT OUTER JOIN
dbo.CampaignRemovalReason ON InteractionTable.CampaignRemovalReasonID = dbo.CampaignRemovalReason.CampaignRemovalReasonID LEFT OUTER JOIN
dbo.NoInterestReason ON InteractionTable.NoInterestReasonID = dbo.NoInterestReason.NoInterestReasonID LEFT OUTER JOIN
dbo.LeadType ON InteractionTable.LeadTypeID = dbo.LeadType.LeadTypeID LEFT OUTER JOIN
dbo.FollowUpAction ON InteractionTable.FollowUpActionID = dbo.FollowUpAction.FollowUpActionID LEFT OUTER JOIN
dbo.DRProjectScranton ON InteractionTable.DodgeProjectID = dbo.DRProjectScranton.DRProjectScrantonId LEFT OUTER JOIN
dbo.Tactic ON InteractionTable.TacticID = dbo.Tactic.TacticID LEFT OUTER JOIN
dbo.ResponseType ON InteractionTable.ResponseTypeID = dbo.ResponseType.ResponseTypeID LEFT OUTER JOIN
dbo.CallDisposition ON InteractionTable.CallDispositionID = dbo.CallDisposition.CallDispositionID LEFT OUTER JOIN
dbo.DiscussionTopic ON InteractionTable.DiscussionTopicID = dbo.DiscussionTopic.DiscussionTopicID LEFT OUTER JOIN
dbo.NoContactReason ON InteractionTable.NoContactReasonID = dbo.NoContactReason.NoContactReasonID LEFT OUTER JOIN
dbo.SpokenTo ON InteractionTable.SpokenToID = dbo.SpokenTo.SpokenToID LEFT OUTER JOIN
dbo.NotVerified ON InteractionTable.NotVerifiedID = dbo.NotVerified.NotVerifiedID LEFT OUTER JOIN
dbo.DPCampaign AS Campaign ON InteractionTable.CampaignID = Campaign.DPCampaignID LEFT OUTER JOIN
dbo.CampaignDisposition ON InteractionTable.CampaignDispositionID = dbo.CampaignDisposition.CampaignDispositionID LEFT OUTER JOIN
dbo.CallType ON InteractionTable.CallTypeID = dbo.CallType.CallTypeID LEFT OUTER JOIN
dbo.CallDuration ON InteractionTable.CallDurationID = dbo.CallDuration.CallDurationID LEFT OUTER JOIN
dbo.CallStatus ON InteractionTable.CallStatusID = dbo.CallStatus.CallStatusID LEFT OUTER JOIN
dbo.NumberOfTiersScranton ON InteractionTable.NumberOfTiersScrantonID = dbo.NumberOfTiersScranton.NumberOfTiersScrantonID LEFT OUTER JOIN
dbo.LockerLocationTypeScranton ON
InteractionTable.LockerLocationTypeScrantonID = dbo.LockerLocationTypeScranton.LockerLocationTypeScrantonID LEFT OUTER JOIN
dbo.ProjectFundSourceScranton ON InteractionTable.ProjectFundSourceScrantonID = dbo.ProjectFundSourceScranton.ProjectFundSourceScrantonID LEFT OUTER JOIN
dbo.ProjectDecisionMakingProcessScranton ON
InteractionTable.ProjectDecisionMakingProcessScrantonID = dbo.ProjectDecisionMakingProcessScranton.ProjectDecisionMakingProcessScrantonID LEFT OUTER JOIN
dbo.ProductType AS ProductType1Scranton ON InteractionTable.ProductType1ScrantonID = ProductType1Scranton.ProductTypeID LEFT OUTER JOIN
dbo.ProductType AS ProductType2Scranton ON InteractionTable.ProductType2ScrantonID = ProductType2Scranton.ProductTypeID LEFT OUTER JOIN
dbo.ProductType AS ProductType3Scranton ON InteractionTable.ProductType3ScrantonID = ProductType3Scranton.ProductTypeID
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment