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

From dbscript Online Help
Jump to: navigation, search
Line 93: Line 93:
 
{| 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.Employee_(table)|HumanResources.Employee]]
 
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 +
 +
|-
 +
| Select
 
| Table
 
| Table
 +
| [[HumanResources.EmployeeAddress_(table)|HumanResources.EmployeeAddress]]
 +
 +
|-
 
| Select
 
| Select
 +
| Table
 +
| [[Person.Address_(table)|Person.Address]]
 +
 
|-
 
|-
| [[HumanResources.EmployeeAddress_(table)|HumanResources.EmployeeAddress]]
+
| Select
 
| Table
 
| Table
 +
| [[Person.Contact_(table)|Person.Contact]]
 +
 +
|-
 
| Select
 
| Select
|-
 
| [[Person.Address_(table)|Person.Address]]
 
 
| Table
 
| Table
| Select
+
| [[Person.CountryRegion_(table)|Person.CountryRegion]]
 +
 
 
|-
 
|-
| [[Person.Contact_(table)|Person.Contact]]
 
| Table
 
 
| Select
 
| Select
|-
 
| [[Person.CountryRegion_(table)|Person.CountryRegion]]
 
 
| Table
 
| Table
| Select
 
|-
 
 
| [[Person.StateProvince_(table)|Person.StateProvince]]
 
| [[Person.StateProvince_(table)|Person.StateProvince]]
| Table
+
 
| Select
 
 
|-
 
|-
| [[.HumanResources_(schema)|.HumanResources]]
 
 
| Schema
 
| Schema
 
| Schema
 
| Schema
 +
| [[HumanResources_(schema)|HumanResources]]
 +
 
|}
 
|}

Revision as of 06:40, 30 November 2009

wikibot

view HumanResources.vEmployee
CREATE VIEW [HumanResources].[vEmployee] 
AS 
SELECT 
    e.[EmployeeID]
    ,c.[Title]
    ,c.[FirstName]
    ,c.[MiddleName]
    ,c.[LastName]
    ,c.[Suffix]
    ,e.[Title] AS [JobTitle] 
    ,c.[Phone]
    ,c.[EmailAddress]
    ,c.[EmailPromotion]
    ,a.[AddressLine1]
    ,a.[AddressLine2]
    ,a.[City]
    ,sp.[Name] AS [StateProvinceName] 
    ,a.[PostalCode]
    ,cr.[Name] AS [CountryRegionName] 
    ,c.[AdditionalContactInfo]
FROM [HumanResources].[Employee] e
    INNER JOIN [Person].[Contact] c 
    ON c.[ContactID] = e.[ContactID]
    INNER JOIN [HumanResources].[EmployeeAddress] ea 
    ON e.[EmployeeID] = ea.[EmployeeID] 
    INNER JOIN [Person].[Address] a 
    ON ea.[AddressID] = a.[AddressID]
    INNER JOIN [Person].[StateProvince] sp 
    ON sp.[StateProvinceID] = a.[StateProvinceID]
    INNER JOIN [Person].[CountryRegion] cr 
    ON cr.[CountryRegionCode] = sp.[CountryRegionCode];

automatically generated

view HumanResources.vEmployee
Description Employee names and addresses.

CREATE VIEW [HumanResources].[vEmployee] 
AS 
SELECT 
    e.[EmployeeID]
    ,c.[Title]
    ,c.[FirstName]
    ,c.[MiddleName]
    ,c.[LastName]
    ,c.[Suffix]
    ,e.[Title] AS [JobTitle] 
    ,c.[Phone]
    ,c.[EmailAddress]
    ,c.[EmailPromotion]
    ,a.[AddressLine1]
    ,a.[AddressLine2]
    ,a.[City]
    ,sp.[Name] AS [StateProvinceName] 
    ,a.[PostalCode]
    ,cr.[Name] AS [CountryRegionName] 
    ,c.[AdditionalContactInfo]
FROM [HumanResources].[Employee] e
    INNER JOIN [Person].[Contact] c 
    ON c.[ContactID] = e.[ContactID]
    INNER JOIN [HumanResources].[EmployeeAddress] ea 
    ON e.[EmployeeID] = ea.[EmployeeID] 
    INNER JOIN [Person].[Address] a 
    ON ea.[AddressID] = a.[AddressID]
    INNER JOIN [Person].[StateProvince] sp 
    ON sp.[StateProvinceID] = a.[StateProvinceID]
    INNER JOIN [Person].[CountryRegion] cr 
    ON cr.[CountryRegionCode] = sp.[CountryRegionCode];


Dependency Type Object Type Referenced Object
Select Table HumanResources.Employee
Select Table HumanResources.EmployeeAddress
Select Table Person.Address
Select Table Person.Contact
Select Table Person.CountryRegion
Select Table Person.StateProvince
Schema Schema HumanResources