Welcome Guest, you are in: Login

devio dbscript ScrewTurn Wiki

RSS RSS

Navigation





Search the wiki
»

PoweredBy

Page History: HumanResources vEmployeeDepartment (view)

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: 2010/06/24 01:08


wikibot

ViewHumanResources.vEmployeeDepartment
DescriptionReturns employee name, title, and current department.

Source

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());

References

Dependency TypeObject TypeReferenced Object
SelectTableHumanResources.Department
SelectTableHumanResources.Employee
SelectTableHumanResources.EmployeeDepartmentHistory
SelectTablePerson.Contact
SchemaSchemaHumanResources

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam.