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

From dbscript Online Help
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|-
+
|- valign="top"
| '''view
+
| '''View
 
| HumanResources.vEmployeeDepartment
 
| HumanResources.vEmployeeDepartment
|-
+
|- valign="top"
 +
| '''Description
 +
| Returns employee name, title, and current department.
 
|}
 
|}
  
 +
=== Source ===
 
<pre>
 
<pre>
 
CREATE VIEW [HumanResources].[vEmployeeDepartment]  
 
CREATE VIEW [HumanResources].[vEmployeeDepartment]  
Line 31: Line 34:
 
WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());
 
WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());
 
</pre>
 
</pre>
 +
 +
=== References ===
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Dependency Type
 +
| '''Object Type
 +
| '''Referenced Object
 +
 +
|- valign="top"
 +
| Select
 +
| Table
 +
| [[HumanResources.Department_(table)|HumanResources.Department]]
 +
 +
|- valign="top"
 +
| Select
 +
| Table
 +
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 +
 +
|- valign="top"
 +
| Select
 +
| Table
 +
| [[HumanResources.EmployeeDepartmentHistory_(table)|HumanResources.EmployeeDepartmentHistory]]
 +
 +
|- valign="top"
 +
| Select
 +
| Table
 +
| [[Person.Contact_(table)|Person.Contact]]
 +
 +
|- valign="top"
 +
| Schema
 +
| Schema
 +
| [[HumanResources_(schema)|HumanResources]]
 +
 +
|}
 +
 +
 
== automatically generated ==
 
== automatically generated ==
  
Line 37: Line 76:
 
| '''view
 
| '''view
 
| HumanResources.vEmployeeDepartment
 
| HumanResources.vEmployeeDepartment
|-
+
|- valign="top"
 
 
 
| '''Description
 
| '''Description
 
| Returns employee name, title, and current department.
 
| Returns employee name, title, and current department.
 
|-
 
|-
 
 
|}
 
|}
  
Line 73: Line 110:
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
|- style="background:silver"
 +
| '''Dependency Type
 +
| '''Object Type
 
| '''Referenced Object
 
| '''Referenced Object
| '''Object Type
+
 
| '''Dependency Type
 
 
 
|-
 
|-
 +
| Select
 +
| Table
 
| [[HumanResources.Department_(table)|HumanResources.Department]]
 
| [[HumanResources.Department_(table)|HumanResources.Department]]
 +
 +
|-
 +
| Select
 
| Table
 
| Table
 +
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 +
 +
|-
 
| Select
 
| Select
 +
| Table
 +
| [[HumanResources.EmployeeDepartmentHistory_(table)|HumanResources.EmployeeDepartmentHistory]]
 +
 
|-
 
|-
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 
| Table
 
 
| Select
 
| Select
|-
 
| [[HumanResources.EmployeeDepartmentHistory_(table)|HumanResources.EmployeeDepartmentHistory]]
 
 
| Table
 
| Table
| Select
+
| [[Person.Contact_(table)|Person.Contact]]
 +
 
 
|-
 
|-
| [[Person.Contact_(table)|Person.Contact]]
+
| Schema
| Table
+
| Schema
| Select
+
| [[HumanResources_(schema)|HumanResources]]
 +
 
 
|}
 
|}

Latest revision as of 23:16, 23 June 2010

wikibot[edit]

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

Source[edit]

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[edit]

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


automatically generated[edit]

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


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