AdventureWorks
HumanResources.vEmployeeDepartmentHistory View
Description
Returns employee name and current and previous departments.
Properties
Creation Date08/01/2010 08:41
Is Schema Bound
Encrypted
Ansi Nulls
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
 EmployeeID int4   
 Title nvarchar8  
 FirstName dbo.Name50   
 MiddleName dbo.Name50  
 LastName dbo.Name50   
 Suffix nvarchar10  
 Shift dbo.Name50   
 Department dbo.Name50   
 GroupName dbo.Name50   
 StartDate datetime4   
 EndDate datetime4  
Objects that HumanResources.vEmployeeDepartmentHistory depends on
 Database ObjectObject TypeDescriptionDep Level
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.1
HumanResources.Department tableHumanResources.DepartmentTableLookup table containing the departments within the Adventure Works Cycles company.1
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.1
HumanResources.EmployeeDepartmentHistory tableHumanResources.EmployeeDepartmentHistoryTableEmployee department transfers.1
dbo.Flag datatypedbo.FlagUser Defined Data Type 2
dbo.Name datatypedbo.NameUser Defined Data Type 2
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 2
dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
HumanResources.Shift tableHumanResources.ShiftTableWork shift lookup table.1
View Definition
CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory] 
AS 

SELECT 
e.[EmployeeID] 
,c.[Title] 
,c.[FirstName] 
,c.[MiddleName] 
,c.[LastName] 
,c.[Suffix] 
,s.[Name] AS [Shift]
,d.[Name] AS [Department] 
,d.[GroupName] 
,edh.[StartDate] 
,edh.[EndDate]
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

Related Objects

HumanResources Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.