Difference between revisions of "HumanResources.vEmployeeDepartment (view)"

From dbscript Online Help
Jump to: navigation, search
Line 37: Line 37:
 
| '''view
 
| '''view
 
| HumanResources.vEmployeeDepartment
 
| HumanResources.vEmployeeDepartment
|-
+
|- valign="top"
  
 
| '''Description
 
| '''Description
Line 76: Line 76:
 
| '''Object Type
 
| '''Object Type
 
| '''Dependency Type
 
| '''Dependency Type
+
 
 
|-
 
|-
 
| [[HumanResources.Department_(table)|HumanResources.Department]]
 
| [[HumanResources.Department_(table)|HumanResources.Department]]
Line 93: Line 93:
 
| Table
 
| Table
 
| Select
 
| Select
 +
|-
 +
| [[.HumanResources_(schema)|.HumanResources]]
 +
| Schema
 +
| Schema
 
|}
 
|}

Revision as of 07:26, 30 November 2009

wikibot

view HumanResources.vEmployeeDepartment
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());

automatically generated

view HumanResources.vEmployeeDepartment
Description Returns employee name, title, and current department.

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


Referenced Object Object Type Dependency Type
HumanResources.Department Table Select
HumanResources.Employee Table Select
HumanResources.EmployeeDepartmentHistory Table Select
Person.Contact Table Select
.HumanResources Schema Schema