Owner: | Purchasing |
Schema bound: | |
Encrypted: | |
Creation Date: | 04/26/2006 |
Modification Date: | 04/26/2006 |
Description: | Vendor (company) names and addresses and the names of vendor employees to contact. |
Name | Data Type | Length | NULL | IsGUID | Description | |
VendorID | int | 4 | ||||
Name | Name | 100 | ||||
ContactType | Name | 100 | ||||
Title | nvarchar | 8 | ||||
FirstName | Name | 100 | ||||
MiddleName | Name | 100 | ||||
LastName | Name | 100 | ||||
Suffix | nvarchar | 10 | ||||
Phone | Phone | 50 | ||||
EmailAddress | nvarchar | 50 | ||||
EmailPromotion | int | 4 | ||||
AddressLine1 | nvarchar | 60 | ||||
AddressLine2 | nvarchar | 60 | ||||
City | nvarchar | 30 | ||||
StateProvinceName | Name | 100 | ||||
PostalCode | nvarchar | 15 | ||||
CountryRegionName | Name | 100 |
Objects that [Purchasing].[vVendor] depends on
Object Name | Owner | Object Type | Dep Level | |
AccountNumber | dbo | User Defined type | 1 | |
Flag | dbo | User Defined type | 1 | |
Name | dbo | User Defined type | 1 | |
NameStyle | dbo | User Defined type | 1 | |
Phone | dbo | User Defined type | 1 | |
AddressType | Person | Table | 2 | |
Contact | Person | Table | 2 | |
ContactType | Person | Table | 2 | |
CountryRegion | Person | Table | 2 | |
SalesTerritory | Sales | Table | 2 | |
Vendor | Purchasing | Table | 2 | |
StateProvince | Person | Table | 3 | |
VendorContact | Purchasing | Table | 3 | |
Address | Person | Table | 4 | |
VendorAddress | Purchasing | Table | 5 |
CREATE VIEW [Purchasing].[vVendor] AS
SELECT
v.[VendorID]
,v.[Name]
,ct.[Name] AS [ContactType]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,[StateProvinceName] = sp.[Name]
,a.[PostalCode]
,[CountryRegionName] = cr.[Name]
FROM [Purchasing].[Vendor] v
INNER JOIN [Purchasing].[VendorContact] vc
ON vc.[VendorID] = v.[VendorID]
INNER JOIN [Person].[Contact] c
ON c.[ContactID] = vc.[ContactID]
INNER JOIN [Person].[ContactType] ct
ON vc.[ContactTypeID] = ct.[ContactTypeID]
INNER JOIN [Purchasing].[VendorAddress] va
ON va.[VendorID] = v.[VendorID]
INNER JOIN [Person].[Address] a
ON a.[AddressID] = va.[AddressID]
INNER JOIN [Person].[StateProvince] sp
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr
ON cr.[CountryRegionCode] = sp.[CountryRegionCode];
See Also
List of views