Purchasing.vVendorWithContacts
Documentation | AdventureWorks |
Schema | Purchasing |
Name | vVendorWithContacts |
Module | Purchasing |
Vendor (company) names and the names of vendor employees to contact.
Columns
Key | Name | Data type | Null | Attributes | References | Description | ||
---|---|---|---|---|---|---|---|---|
1 | BusinessEntityID | int | ||||||
2 | Name | nvarchar(50) | ||||||
3 | ContactType | nvarchar(50) | ||||||
4 | Title | nvarchar(8) | ||||||
5 | FirstName | nvarchar(50) | ||||||
6 | MiddleName | nvarchar(50) | ||||||
7 | LastName | nvarchar(50) | ||||||
8 | Suffix | nvarchar(10) | ||||||
9 | PhoneNumber | nvarchar(25) | ||||||
10 | PhoneNumberType | nvarchar(50) | ||||||
11 | EmailAddress | nvarchar(50) | ||||||
12 | EmailPromotion | int |
Uses
Name |
---|
Purchasing.vVendorWithContacts
|
Script
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]; |
Exported: 2019-02-04 23:13, Last imported: 2018-03-07 11:56