Owner: | HumanResources |
Schema bound: | |
Encrypted: | |
Creation Date: | 04/26/2006 |
Modification Date: | 07/20/2008 |
Description: | Employee names and addresses. |
Name | Data Type | Length | NULL | IsGUID | Description | |
EmployeeID | int | 4 | ||||
Title | nvarchar | 8 | ||||
FirstName | Name | 100 | ||||
MiddleName | Name | 100 | ||||
LastName | Name | 100 | ||||
Suffix | nvarchar | 10 | ||||
JobTitle | nvarchar | 50 | ||||
Phone | Phone | 50 | ||||
EmailAddress | nvarchar | 50 | ||||
EmailPromotion | int | 4 | ||||
AddressLine1 | nvarchar | 60 | ||||
AddressLine2 | nvarchar | 60 | ||||
City | nvarchar | 30 | ||||
StateProvinceName | Name | 100 | ||||
PostalCode | nvarchar | 15 | ||||
CountryRegionName | Name | 100 | ||||
AdditionalContactInfo | xml | -1 | ||||
Test | varchar | 3 |
Objects that [HumanResources].[vEmployee] depends on
Object Name | Owner | Object Type | Dep Level | |
Flag | dbo | User Defined type | 1 | |
Name | dbo | User Defined type | 1 | |
NameStyle | dbo | User Defined type | 1 | |
Phone | dbo | User Defined type | 1 | |
Contact | Person | Table | 2 | |
CountryRegion | Person | Table | 2 | |
SalesTerritory | Sales | Table | 2 | |
Employee | HumanResources | Table | 3 | |
StateProvince | Person | Table | 3 | |
Address | Person | Table | 4 | |
EmployeeAddress | HumanResources | Table | 5 |
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],
'sss' as Test
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];
See Also
List of views