AdventureWorks
HumanResources.vEmployeeDepartment View
Description
Returns employee name, title, and current department.
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  
 JobTitle nvarchar50   
 Department dbo.Name50   
 GroupName dbo.Name50   
 StartDate datetime4   
Objects that HumanResources.vEmployeeDepartment 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.NameStyle datatypedbo.NameStyleUser Defined Data Type 2
dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
HumanResources.Shift tableHumanResources.ShiftTableWork shift lookup table.2
View Definition
CREATE VIEW [HumanResources].[vEmployeeDepartment] 
AS 

SELECT 
e.[EmployeeID] 
,c.[Title] 
,c.[FirstName] 
,c.[MiddleName] 
,c.[LastName] 
,c.[Suffix] 
,e.[Title] AS [JobTitle] 
,d.[Name] AS [Department] 
,d.[GroupName] 
,edh.[StartDate] 
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] 
WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());
See Also

Related Objects

HumanResources Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.