Properties

Owner: HumanResources 
Schema bound:  
Encrypted:  
Creation Date: 04/26/2006 
Modification Date: 07/20/2008 
Description: Employee names and addresses. 

Columns

Name Data Type Length NULL IsGUID Description
  EmployeeID  int       
  Title  nvarchar       
  FirstName  Name  100       
  MiddleName  Name  100       
  LastName  Name  100       
  Suffix  nvarchar  10       
  JobTitle  nvarchar  50       
  Phone  Phone  50       
  EmailAddress  nvarchar  50       
  EmailPromotion  int       
  AddressLine1  nvarchar  60       
  AddressLine2  nvarchar  60       
  City  nvarchar  30       
  StateProvinceName  Name  100       
  PostalCode  nvarchar  15       
  CountryRegionName  Name  100       
  AdditionalContactInfo  xml  -1       
  Test  varchar       
Total: 18 column(s)

Objects that [HumanResources].[vEmployee] 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 
  Contact  Person  Table 
  CountryRegion  Person  Table 
  SalesTerritory  Sales  Table 
  Employee  HumanResources  Table 
  StateProvince  Person  Table 
  Address  Person  Table 
  EmployeeAddress  HumanResources  Table 
Total: 11 objects

SQL


CREATE VIEW [HumanResources].[vEmployee]
AS
SELECT
    e.[EmployeeID]
    ,c.[Title]
    ,c.[FirstName]
    ,c.[MiddleName]
    ,c.[LastName]
    ,c.[Suffix]
    ,e.[Title] AS [JobTitle]
    ,c.[Phone]
    ,c.[EmailAddress]
    ,c.[EmailPromotion]
    ,a.[AddressLine1]
    ,a.[AddressLine2]
    ,a.[City]
    ,sp.[Name] AS [StateProvinceName]
    ,a.[PostalCode]
    ,cr.[Name] AS [CountryRegionName]
    ,c.[AdditionalContactInfo],
    'sss' as Test
FROM [HumanResources].[Employee] e
    INNER JOIN [Person].[Contact] c
    ON c.[ContactID] = e.[ContactID]
    INNER JOIN [HumanResources].[EmployeeAddress] ea
    ON e.[EmployeeID] = ea.[EmployeeID]
    INNER JOIN [Person].[Address] a
    ON ea.[AddressID] = a.[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