HumanResources.Employee Table

Information

NameEmployee
SchemaHumanResources
Row Count0
Data Size 
Index Size 
Reserved Size 
Unused Size 
Created29.3.2010. 21:58:18
Modified29.3.2010. 21:58:56

Extended Properties

NameTypeProperty NameValue
EmployeeTABLEMS_DescriptionEmployee information such as salary, department, and title.

Columns

PKKeyIdentityNameData TypeAllow NullsCollationReferencesDefaultComputedCompute Expression
   EmployeeIDint   
 
 
 
   NationalIDNumbernvarchar(15) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   ContactIDint  Person.Contact.ContactID
 
 
 
   LoginIDnvarchar(256) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   ManagerIDint  HumanResources.Employee.EmployeeID
 
 
 
   Titlenvarchar(50) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   BirthDatedatetime   
 
 
 
   MaritalStatusnchar(1) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   Gendernchar(1) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   HireDatedatetime   
 
 
 
   SalariedFlagbit   
((1))
 
 
   VacationHourssmallint   
((0))
 
 
   SickLeaveHourssmallint   
((0))
 
 
   CurrentFlagbit   
((1))
 
 
   rowguiduniqueidentifier   
(newid())
 
 
   ModifiedDatedatetime   
(getdate())
 
 

Indexes

NameTypePrimaryUniqueColumns
PK_Employee_EmployeeIDClustered  EmployeeID
AK_Employee_LoginIDNonClustered  LoginID
AK_Employee_NationalIDNumberNonClustered  NationalIDNumber
AK_Employee_rowguidNonClustered  rowguid
IX_Employee_ManagerIDNonClustered  ManagerID

Check Constraints

NameColumnEnabledTrustedExpression
CK_Employee_BirthDateBirthDate  ([BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate()))
CK_Employee_MaritalStatusMaritalStatus  (upper([MaritalStatus])='S' OR upper([MaritalStatus])='M')
CK_Employee_GenderGender  (upper([Gender])='F' OR upper([Gender])='M')
CK_Employee_HireDateHireDate  ([HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate()))
CK_Employee_VacationHoursVacationHours  ([VacationHours]>=(-40) AND [VacationHours]<=(240))
CK_Employee_SickLeaveHoursSickLeaveHours  ([SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120))

Foreign Key Constraints

NameTypeReferenced Table
FK_Employee_Contact_ContactIDForeign keyPerson.Contact
FK_Employee_Employee_ManagerIDForeign keyHumanResources.Employee

Triggers

NameActivates onInstead OfFor ReplicationEnabledCreatedModified
dEmployeeDELETE   29.3.2010. 21:58:5629.3.2010. 21:58:56

SQL Script

CREATE TABLE [HumanResources].[Employee] (
    [EmployeeID] int NOT NULL IDENTITY,
    [NationalIDNumber] nvarchar(15) NOT NULL,
    [ContactID] int NOT NULL,
    [LoginID] nvarchar(256) NOT NULL,
    [ManagerID] int NULL,
    [Title] nvarchar(50) NOT NULL,
    [BirthDate] datetime NOT NULL,
    [MaritalStatus] nchar(1) NOT NULL,
    [Gender] nchar(1) NOT NULL,
    [HireDate] datetime NOT NULL,
    [SalariedFlag] bit NOT NULL DEFAULT ((1)),
    [VacationHours] smallint NOT NULL DEFAULT ((0)),
    [SickLeaveHours] smallint NOT NULL DEFAULT ((0)),
    [CurrentFlag] bit NOT NULL DEFAULT ((1)),
    [rowguid] uniqueidentifier NOT NULL DEFAULT (newid()),
    [ModifiedDate] datetime NOT NULL DEFAULT (getdate())
);
CREATE UNIQUE INDEX [AK_Employee_LoginID] on [HumanResources].[Employee]([LoginID]);
CREATE UNIQUE INDEX [AK_Employee_NationalIDNumber] on [HumanResources].[Employee]([NationalIDNumber]);
CREATE UNIQUE INDEX [AK_Employee_rowguid] on [HumanResources].[Employee]([rowguid]);
CREATE INDEX [IX_Employee_ManagerID] on [HumanResources].[Employee]([ManagerID]);