Owner: Sales 
Schema bound:  
Creation Date: 04/26/2006 
Modification Date: 04/26/2006 
Description: Individual customers (names and addresses) that purchase Adventure Works Cycles products online. 


Name Data Type Length NULL IsGUID Description
  CustomerID  int       
  Title  nvarchar       
  FirstName  Name  100       
  MiddleName  Name  100       
  LastName  Name  100       
  Suffix  nvarchar  10       
  Phone  Phone  50       
  EmailAddress  nvarchar  50       
  EmailPromotion  int       
  AddressType  Name  100       
  AddressLine1  nvarchar  60       
  AddressLine2  nvarchar  60       
  City  nvarchar  30       
  StateProvinceName  Name  100       
  PostalCode  nvarchar  15       
  CountryRegionName  Name  100       
  Demographics  xml  -1       
Total: 17 column(s)

Objects that [Sales].[vIndividualCustomer] depends on

Object Name Owner Object Type Dep Level
  Flag  dbo  User Defined type 
  Name  dbo  User Defined type 
  NameStyle  dbo  User Defined type 
  Phone  dbo  User Defined type 
  ufnLeadingZeros  dbo  Function 
  AddressType  Person  Table 
  Contact  Person  Table 
  CountryRegion  Person  Table 
  SalesTerritory  Sales  Table 
  Customer  Sales  Table 
  StateProvince  Person  Table 
  Address  Person  Table 
  Individual  Sales  Table 
  CustomerAddress  Sales  Table 
Total: 14 objects


CREATE VIEW [Sales].[vIndividualCustomer]
    ,at.[Name] AS [AddressType]
    ,[StateProvinceName] = sp.[Name]
    ,[CountryRegionName] = cr.[Name]
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

List of views