AdventureWorks
Sales.vIndividualCustomer View
Description
Individual customers (names and addresses) that purchase Adventure Works Cycles products online.
Properties
Creation Date08/01/2010 08:41
Is Schema Bound
Encrypted
Ansi Nulls
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
 CustomerID int4   
 Title nvarchar8  
 FirstName dbo.Name50   
 MiddleName dbo.Name50  
 LastName dbo.Name50   
 Suffix nvarchar10  
 Phone dbo.Phone25  
 EmailAddress nvarchar50  
 EmailPromotion int4   
 AddressType dbo.Name50   
 AddressLine1 nvarchar60   
 AddressLine2 nvarchar60  
 City nvarchar30   
 StateProvinceName dbo.Name50   
 PostalCode nvarchar15   
 CountryRegionName dbo.Name50   
 Demographics Sales.IndividualSurveySchemaCollection16  
Objects that Sales.vIndividualCustomer depends on
 Database ObjectObject TypeDescriptionDep Level
Person.Address tablePerson.AddressTableStreet address information for customers, employees, and vendors.1
Person.AddressType tablePerson.AddressTypeTableTypes of addresses stored in the Address table. 1
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.1
Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.1
Sales.Customer tableSales.CustomerTableCurrent customer information. Also see the Individual and Store tables.1
Sales.CustomerAddress tableSales.CustomerAddressTableCross-reference table mapping customers to their address(es).1
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.4
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.4
dbo.Flag datatypedbo.FlagUser Defined Data Type 2
Sales.Individual tableSales.IndividualTableDemographic data about customers that purchase Adventure Works products online.1
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 2
dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
Sales.SalesPerson tableSales.SalesPersonTableSales representative current information.3
Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.2
Person.StateProvince tablePerson.StateProvinceTableState and province lookup table.1
Sales.Store tableSales.StoreTableCustomers (resellers) of Adventure Works products.2
dbo.ufnLeadingZeros functiondbo.ufnLeadingZerosUser Defined FunctionScalar function used by the Sales.Customer table to help set the account number.2
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.3
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.3
View Definition
CREATE VIEW [Sales].[vIndividualCustomer] 
AS 

SELECT 
i.[CustomerID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,c.[Phone]
,c.[EmailAddress]
,c.[EmailPromotion]
,at.[Name] AS [AddressType]
,a.[AddressLine1]
,a.[AddressLine2]
,a.[City]
,[StateProvinceName] = sp.[Name]
,a.[PostalCode]
,[CountryRegionName] = cr.[Name]
,i.[Demographics]
FROM [Sales].[Individual] i
INNER JOIN [Person].[Contact] c 
ON c.[ContactID] = i.[ContactID]
INNER JOIN [Sales].[CustomerAddress] ca 
ON ca.[CustomerID] = i.[CustomerID]
INNER JOIN [Person].[Address] a 
ON a.[AddressID] = ca.[AddressID]
INNER JOIN [Person].[StateProvince] sp 
ON sp.[StateProvinceID] = a.[StateProvinceID]
INNER JOIN [Person].[CountryRegion] cr 
ON cr.[CountryRegionCode] = sp.[CountryRegionCode]
INNER JOIN [Person].[AddressType] at 
ON ca.[AddressTypeID] = at.[AddressTypeID]
WHERE i.[CustomerID] IN (SELECT [Sales].[Customer].[CustomerID] 
FROM [Sales].[Customer] WHERE UPPER([Sales].[Customer].[CustomerType]) = 'I');
See Also

Related Objects

Sales Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.