View:
[AdventureWorks2016CTP3].[HumanResources].[vEmployee]
View properties
| Name | Value |
| Schema | [HumanResources] |
| Owner | [dbo] |
| Creation date | 16.11.2015 |
| Is schema bound | |
| Encrypted | |
| ID | 1037246750 |
Creation options
| Name | Value |
| QUOTED_IDENTIFIER | ON |
| ANSI_NULLS | ON |
Resultset
| Name | Description | Data type | Max length |
| BusinessEntityID | int | 4 | |
| Title | nvarchar | 8 | |
| FirstName | [dbo].[Name] | 50 | |
| MiddleName | [dbo].[Name] | 50 | |
| LastName | [dbo].[Name] | 50 | |
| Suffix | nvarchar | 10 | |
| JobTitle | nvarchar | 50 | |
| PhoneNumber | [dbo].[Phone] | 25 | |
| PhoneNumberType | [dbo].[Name] | 50 | |
| EmailAddress | nvarchar | 50 | |
| EmailPromotion | int | 4 | |
| AddressLine1 | nvarchar | 60 | |
| AddressLine2 | nvarchar | 60 | |
| City | nvarchar | 30 | |
| StateProvinceName | [dbo].[Name] | 50 | |
| PostalCode | nvarchar | 15 | |
| CountryRegionName | [dbo].[Name] | 50 | |
| AdditionalContactInfo | xml | 2147483647 |
Objects that [HumanResources].[vEmployee] depends on
| Object name | Object type | Dep level |
| [HumanResources] | Schema | 1 |
| [Person].[Address] | Table | 1 |
| [Person].[BusinessEntityAddress] | Table | 1 |
| [Person].[CountryRegion] | Table | 1 |
| [Person].[EmailAddress] | Table | 1 |
| [HumanResources].[Employee] | Table | 1 |
| [Person].[Person] | Table | 1 |
| [Person].[PersonPhone] | Table | 1 |
| [Person].[PhoneNumberType] | Table | 1 |
| [Person].[StateProvince] | Table | 1 |
Extended properties
| Name | Value |
| MS_Description | Employee names and addresses. |
SQL
SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON GO CREATE VIEW [HumanResources].[vEmployee] AS SELECT e.[BusinessEntityID] ,p.[Title] ,p.[FirstName] ,p.[MiddleName] ,p.[LastName] ,p.[Suffix] ,e.[JobTitle] ,pp.[PhoneNumber] ,pnt.[Name] AS [PhoneNumberType] ,ea.[EmailAddress] ,p.[EmailPromotion] ,a.[AddressLine1] ,a.[AddressLine2] ,a.[City] ,sp.[Name] AS [StateProvinceName] ,a.[PostalCode] ,cr.[Name] AS [CountryRegionName] ,p.[AdditionalContactInfo] FROM [HumanResources].[Employee] e INNER JOIN [Person].[Person] p ON p.[BusinessEntityID] = e.[BusinessEntityID] INNER JOIN [Person].[BusinessEntityAddress] bea ON bea.[BusinessEntityID] = e.[BusinessEntityID] INNER JOIN [Person].[Address] a ON a.[AddressID] = bea.[AddressID] INNER JOIN [Person].[StateProvince] sp ON sp.[StateProvinceID] = a.[StateProvinceID] INNER JOIN [Person].[CountryRegion] cr ON cr.[CountryRegionCode] = sp.[CountryRegionCode] LEFT OUTER JOIN [Person].[PersonPhone] pp ON pp.BusinessEntityID = p.[BusinessEntityID] LEFT OUTER JOIN [Person].[PhoneNumberType] pnt ON pp.[PhoneNumberTypeID] = pnt.[PhoneNumberTypeID] LEFT OUTER JOIN [Person].[EmailAddress] ea ON p.[BusinessEntityID] = ea.[BusinessEntityID]; GO EXEC sp_addextendedproperty N'MS_Description', N'Employee names and addresses.', 'SCHEMA', N'HumanResources', 'VIEW', N'vEmployee', NULL, NULL GO |
See also