Northwind Database (Document! X Sample)
AdventureWorks Database / Purchasing Schema / Purchasing.vVendorWithContacts View
In This Topic
    Purchasing.vVendorWithContacts View
    In This Topic
    Description
    Vendor (company) names and the names of vendor employees to contact.
    Properties
    Creation Date27/10/2017 14:33
    Is Schema Bound
    Encrypted
    Ansi Nulls
    Columns
     Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
      Integer4   
      dbo.Name50   
      dbo.Name50   
      VarWChar8  
      dbo.Name50   
      dbo.Name50  
      dbo.Name50   
      VarWChar10  
      dbo.Phone25  
      dbo.Name50  
      VarWChar50  
      Integer4   
    Objects that Purchasing.vVendorWithContacts depends on
     Database ObjectObject TypeDescriptionDep Level
    dbo.AccountNumber datatypedbo.AccountNumberUser Defined Data Type 2
    Person.BusinessEntity tablePerson.BusinessEntityTableSource of the ID that connects vendors, customers, and employees with address and contact information.2
    Person.BusinessEntityContact tablePerson.BusinessEntityContactTableCross-reference table mapping stores, vendors, and employees to people1
    Person.ContactType tablePerson.ContactTypeTableLookup table containing the types of business entity contacts.1
    Person.EmailAddress tablePerson.EmailAddressTableWhere to send a person email.1
    dbo.ErrorLog tabledbo.ErrorLogTableAudit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.3
    dbo.Flag datatypedbo.FlagUser Defined Data Type 4
    dbo.Name datatypedbo.NameUser Defined Data Type 2
    dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 5
    Person.Person tablePerson.PersonTableHuman beings involved with AdventureWorks: employees, customer contacts, and vendor contacts.4
    Person.PersonPhone tablePerson.PersonPhoneTableTelephone number and type of a person.1
    dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
    Person.PhoneNumberType tablePerson.PhoneNumberTypeTableType of phone number of a person.1
    dbo.uspLogError proceduredbo.uspLogErrorStored ProcedureLogs error information in the ErrorLog table about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without inserting error information.2
    dbo.uspPrintError proceduredbo.uspPrintErrorStored ProcedurePrints error information about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without printing any error information.2
    Purchasing.Vendor tablePurchasing.VendorTableCompanies from whom Adventure Works Cycles purchases parts or other goods.1
    View Definition
    CREATE VIEW [Purchasing].[vVendorWithContacts] AS 
    
    SELECT 
        v.[BusinessEntityID]
        ,v.[Name]
        ,ct.[Name] AS [ContactType] 
        ,p.[Title] 
        ,p.[FirstName] 
        ,p.[MiddleName] 
        ,p.[LastName] 
        ,p.[Suffix] 
        ,pp.[PhoneNumber] 
        ,pnt.[Name] AS [PhoneNumberType]
        ,ea.[EmailAddress] 
        ,p.[EmailPromotion] 
    FROM [Purchasing].[Vendor] v
        INNER JOIN [Person].[BusinessEntityContact] bec 
        ON bec.[BusinessEntityID] = v.[BusinessEntityID]
        INNER JOIN [Person].ContactType ct
        ON ct.[ContactTypeID] = bec.[ContactTypeID]
        INNER JOIN [Person].[Person] p
        ON p.[BusinessEntityID] = bec.[PersonID]
        LEFT OUTER JOIN [Person].[EmailAddress] ea
        ON ea.[BusinessEntityID] = p.[BusinessEntityID]
        LEFT OUTER JOIN [Person].[PersonPhone] pp
        ON pp.[BusinessEntityID] = p.[BusinessEntityID]
        LEFT OUTER JOIN [Person].[PhoneNumberType] pnt
        ON pnt.[PhoneNumberTypeID] = pp.[PhoneNumberTypeID];
    
    See Also