Owner: HumanResources 
Schema bound:  
Creation Date: 04/26/2006 
Modification Date: 04/26/2006 
Description: Returns employee name and current and previous departments. 


Name Data Type Length NULL IsGUID Description
  EmployeeID  int       
  Title  nvarchar       
  FirstName  Name  100       
  MiddleName  Name  100       
  LastName  Name  100       
  Suffix  nvarchar  10       
  Shift  Name  100       
  Department  Name  100       
  GroupName  Name  100       
  StartDate  datetime       
  EndDate  datetime       
Total: 11 column(s)

Objects that [HumanResources].[vEmployeeDepartmentHistory] 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 
  Department  HumanResources  Table 
  Shift  HumanResources  Table 
  Employee  HumanResources  Table 
  EmployeeDepartmentHistory  HumanResources  Table 
Total: 9 objects


CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory]
    ,s.[Name] AS [Shift]
    ,d.[Name] AS [Department]
FROM [HumanResources].[Employee] e
    INNER JOIN [Person].[Contact] c
    ON c.[ContactID] = e.[ContactID]
    INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh
    ON e.[EmployeeID] = edh.[EmployeeID]
    INNER JOIN [HumanResources].[Department] d
    ON edh.[DepartmentID] = d.[DepartmentID]
    INNER JOIN [HumanResources].[Shift] s
    ON s.[ShiftID] = edh.[ShiftID];

See Also

List of views