Views [HumanResources].[vEmployeeDepartment]
Returns employee name, title, and current department.
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
ANSI Nulls OnTrue
Quoted Identifier OnTrue
Created13:14:55 14 marca 2012
Last Modified13:14:55 14 marca 2012
NameData TypeMax Length (Bytes)
BusinessEntityIDint4
Titlenvarchar(8)16
FirstName[dbo].[Name]100
MiddleName[dbo].[Name]100
LastName[dbo].[Name]100
Suffixnvarchar(10)20
JobTitlenvarchar(50)100
Department[dbo].[Name]100
GroupName[dbo].[Name]100
StartDatedate3

CREATE VIEW [HumanResources].[vEmployeeDepartment]
AS
SELECT
   e.[BusinessEntityID]
   ,p.[Title]
   ,p.[FirstName]
   ,p.[MiddleName]
   ,p.[LastName]
   ,p.[Suffix]
   ,e.[JobTitle]
   ,d.[Name] AS [Department]
   ,d.[GroupName]
   ,edh.[StartDate]
FROM [HumanResources].[Employee] e
   INNER JOIN [Person].[Person] p
   ON p.[BusinessEntityID] = e.[BusinessEntityID]
   INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh
   ON e.[BusinessEntityID] = edh.[BusinessEntityID]
   INNER JOIN [HumanResources].[Department] d
   ON edh.[DepartmentID] = d.[DepartmentID]
WHERE edh.EndDate IS NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'Returns employee name, title, and current department.', 'SCHEMA', N'HumanResources', 'VIEW', N'vEmployeeDepartment', NULL, NULL
GO