AdventureWorks
Purchasing.vVendor View
Description
Vendor (company) names and addresses and the names of vendor employees to contact.
Properties
Creation Date08/01/2010 08:41
Is Schema Bound
Encrypted
Ansi Nulls
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
 VendorID int4   
 Name dbo.Name50   
 ContactType dbo.Name50   
 Title nvarchar8  
 FirstName dbo.Name50   
 MiddleName dbo.Name50  
 LastName dbo.Name50   
 Suffix nvarchar10  
 Phone dbo.Phone25  
 EmailAddress nvarchar50  
 EmailPromotion int4   
 AddressLine1 nvarchar60   
 AddressLine2 nvarchar60  
 City nvarchar30   
 StateProvinceName dbo.Name50   
 PostalCode nvarchar15   
 CountryRegionName dbo.Name50   
Objects that Purchasing.vVendor depends on
 Database ObjectObject TypeDescriptionDep Level
dbo.AccountNumber datatypedbo.AccountNumberUser Defined Data Type 2
Person.Address tablePerson.AddressTableStreet address information for customers, employees, and vendors.1
Person.AddressType tablePerson.AddressTypeTableTypes of addresses stored in the Address table. 2
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.1
Person.ContactType tablePerson.ContactTypeTableLookup table containing the types of contacts stored in Contact.1
Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.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 2
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 2
dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.2
Person.StateProvince tablePerson.StateProvinceTableState and province lookup table.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
Purchasing.VendorAddress tablePurchasing.VendorAddressTableCross-reference mapping vendors and addresses.1
Purchasing.VendorContact tablePurchasing.VendorContactTableCross-reference table mapping vendors and their employees.1
View Definition
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

Related Objects

Purchasing Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.