Editing HumanResources.Employee (table)

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|- valign="top"
+
|-
 
| '''Table
 
| '''Table
 
| HumanResources.Employee
 
| HumanResources.Employee
|- valign="top"
+
|-
| '''Description
 
| Employee information such as salary, department, and title.
 
 
|}
 
|}
  
=== Columns ===
+
 
 
{| 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"
Line 17: Line 15:
 
| '''Nullable
 
| '''Nullable
 
| '''Default
 
| '''Default
| '''Description
+
| '''PK
 
+
| '''Index
|- valign="top"
+
 +
|-
 
| EmployeeID
 
| EmployeeID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
| Primary key for Employee records.
+
| PK_Employee_EmployeeID
|- valign="top"
+
|
 +
|-
 
| NationalIDNumber
 
| NationalIDNumber
 
| nvarchar(15)
 
| nvarchar(15)
 
| not null
 
| not null
 
|  
 
|  
| Unique national identification number such as a social security number.
+
|  
|- valign="top"
+
| AK_Employee_NationalIDNumber
 +
|-
 
| ContactID
 
| ContactID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
| Identifies the employee in the Contact table. Foreign key to Contact.ContactID.
+
|  
|- valign="top"
+
|
 +
|-
 
| LoginID
 
| LoginID
 
| nvarchar(256)
 
| nvarchar(256)
 
| not null
 
| not null
 
|  
 
|  
| Network login.
+
|  
|- valign="top"
+
| AK_Employee_LoginID
 +
|-
 
| ManagerID
 
| ManagerID
 
| int
 
| int
 
| null
 
| null
 
|  
 
|  
| Manager to whom the employee is assigned. Foreign Key to Employee.M
+
|  
|- valign="top"
+
| IX_Employee_ManagerID
 +
|-
 
| Title
 
| Title
 
| nvarchar(50)
 
| nvarchar(50)
 
| not null
 
| not null
 
|  
 
|  
| Work title such as Buyer or Sales Representative.
+
|  
|- valign="top"
+
|
 +
|-
 
| BirthDate
 
| BirthDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
|  
 
|  
| Date of birth.
+
|  
|- valign="top"
+
|
 +
|-
 
| MaritalStatus
 
| MaritalStatus
 
| nchar(1)
 
| nchar(1)
 
| not null
 
| not null
 
|  
 
|  
| M = Married, S = Single
+
|  
|- valign="top"
+
|
 +
|-
 
| Gender
 
| Gender
 
| nchar(1)
 
| nchar(1)
 
| not null
 
| not null
 
|  
 
|  
| M = Male, F = Female
+
|  
|- valign="top"
+
|
 +
|-
 
| HireDate
 
| HireDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
|  
 
|  
| Employee hired on this date.
+
|  
|- valign="top"
+
|
 +
|-
 
| SalariedFlag
 
| SalariedFlag
 
| dbo.Flag
 
| dbo.Flag
 
| not null
 
| not null
 
| ((1))
 
| ((1))
| Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining.
+
|  
|- valign="top"
+
|
 +
|-
 
| VacationHours
 
| VacationHours
 
| smallint
 
| smallint
 
| not null
 
| not null
 
| ((0))
 
| ((0))
| Number of available vacation hours.
+
|  
|- valign="top"
+
|
 +
|-
 
| SickLeaveHours
 
| SickLeaveHours
 
| smallint
 
| smallint
 
| not null
 
| not null
 
| ((0))
 
| ((0))
| Number of available sick leave hours.
+
|  
|- valign="top"
+
|
 +
|-
 
| CurrentFlag
 
| CurrentFlag
 
| dbo.Flag
 
| dbo.Flag
 
| not null
 
| not null
 
| ((1))
 
| ((1))
| 0 = Inactive, 1 = Active
+
|  
|- valign="top"
+
|
 +
|-
 
| rowguid
 
| rowguid
 
| uniqueidentifier
 
| uniqueidentifier
 
| not null
 
| not null
 
| (newid())
 
| (newid())
| ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
+
|  
|- valign="top"
+
| AK_Employee_rowguid
 +
|-
 
| ModifiedDate
 
| ModifiedDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
| (getdate())
 
| (getdate())
| Date and time the record was last updated.
 
|}
 
 
=== Primary Key ===
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
| '''Primary Key
 
| '''Columns
 
|- valign="top"
 
| PK_Employee_EmployeeID
 
| EmployeeID
 
|}
 
 
=== Indexes ===
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
| '''Index
 
| '''Type
 
| '''Columns
 
 
|- valign="top"
 
| AK_Employee_LoginID
 
| Unique
 
| LoginID
 
|- valign="top"
 
| AK_Employee_NationalIDNumber
 
| Unique
 
| NationalIDNumber
 
|- valign="top"
 
| AK_Employee_rowguid
 
| Unique
 
| rowguid
 
|- valign="top"
 
| IX_Employee_ManagerID
 
 
|  
 
|  
| ManagerID
+
|  
 
|}
 
|}
  
=== Check Constraints ===
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
| '''Check Constraint
 
| '''Expression
 
| '''Description
 
  
|- valign="top"
 
| CK_Employee_BirthDate
 
| ([BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate()))
 
| Check constraint [BirthDate] >= '1930-01-01' AND [BirthDate] <= dateadd(year,(-18),GETDATE())
 
|- valign="top"
 
| CK_Employee_Gender
 
| (upper([Gender])='F' OR upper([Gender])='M')
 
| Check constraint [Gender]='f' OR [Gender]='m' OR [Gender]='F' OR [Gender]='M'
 
|- valign="top"
 
| CK_Employee_HireDate
 
| ([HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate()))
 
| Check constraint [HireDate] >= '1996-07-01' AND [HireDate] <= dateadd(day,(1),GETDATE())
 
|- valign="top"
 
| CK_Employee_MaritalStatus
 
| (upper([MaritalStatus])='S' OR upper([MaritalStatus])='M')
 
| Check constraint [MaritalStatus]='s' OR [MaritalStatus]='m' OR [MaritalStatus]='S' OR [MaritalStatus]='M'
 
|- valign="top"
 
| CK_Employee_SickLeaveHours
 
| ([SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120))
 
| Check constraint [SickLeaveHours] >= (0) AND [SickLeaveHours] <= (120)
 
|- valign="top"
 
| CK_Employee_VacationHours
 
| ([VacationHours]>=(-40) AND [VacationHours]<=(240))
 
| Check constraint [VacationHours] >= (-40) AND [VacationHours] <= (240)
 
|}
 
  
=== Foreign Keys ===
 
 
{| 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"
Line 191: Line 139:
 
| '''Column
 
| '''Column
 
| '''Referenced Column
 
| '''Referenced Column
 
+
|- valign="top"
+
|-
 
| [[Person.Contact_(table)|Person.Contact]]
 
| [[Person.Contact_(table)|Person.Contact]]
 
| ContactID
 
| ContactID
 
| ContactID
 
| ContactID
|- valign="top"
+
|-
 
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 
| ManagerID
 
| ManagerID
Line 202: Line 150:
 
|}
 
|}
  
=== Detail Tables ===
+
 
 
{| 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"
Line 208: Line 156:
 
| '''Column
 
| '''Column
 
| '''Referencing Column
 
| '''Referencing Column
 
+
|- valign="top"
+
|-
 
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 
| EmployeeID
 
| EmployeeID
 
| ManagerID
 
| ManagerID
|- valign="top"
+
|-
 
| [[HumanResources.EmployeeAddress_(table)|HumanResources.EmployeeAddress]]
 
| [[HumanResources.EmployeeAddress_(table)|HumanResources.EmployeeAddress]]
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
|- valign="top"
+
|-
 
| [[HumanResources.EmployeeDepartmentHistory_(table)|HumanResources.EmployeeDepartmentHistory]]
 
| [[HumanResources.EmployeeDepartmentHistory_(table)|HumanResources.EmployeeDepartmentHistory]]
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
|- valign="top"
+
|-
 
| [[HumanResources.EmployeePayHistory_(table)|HumanResources.EmployeePayHistory]]
 
| [[HumanResources.EmployeePayHistory_(table)|HumanResources.EmployeePayHistory]]
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
|- valign="top"
+
|-
 
| [[HumanResources.JobCandidate_(table)|HumanResources.JobCandidate]]
 
| [[HumanResources.JobCandidate_(table)|HumanResources.JobCandidate]]
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
|- valign="top"
+
|-
 
| [[Purchasing.PurchaseOrderHeader_(table)|Purchasing.PurchaseOrderHeader]]
 
| [[Purchasing.PurchaseOrderHeader_(table)|Purchasing.PurchaseOrderHeader]]
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
 
| EmployeeID
|- valign="top"
+
|-
 
| [[Sales.SalesPerson_(table)|Sales.SalesPerson]]
 
| [[Sales.SalesPerson_(table)|Sales.SalesPerson]]
 
| EmployeeID
 
| EmployeeID
Line 239: Line 187:
 
|}
 
|}
  
=== Triggers ===
+
 
 
{| 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"
| '''Trigger
+
| '''Triggers
 
| '''Type
 
| '''Type
 
+
|- valign="top"
+
|-
 
| dEmployee
 
| dEmployee
 
| INSTEAD OF DELETE
 
| INSTEAD OF DELETE
 
|}
 
|}
 
==== Trigger dEmployee ====
 
<pre>
 
CREATE TRIGGER [HumanResources].[dEmployee] ON [HumanResources].[Employee]
 
INSTEAD OF DELETE NOT FOR REPLICATION AS
 
BEGIN
 
    DECLARE @Count int;
 
 
    SET @Count = @@ROWCOUNT;
 
    IF @Count = 0
 
        RETURN;
 
 
    SET NOCOUNT ON;
 
 
    BEGIN
 
        RAISERROR
 
            (N'Employees cannot be deleted. They can only be marked as not current.', -- Message
 
            10, -- Severity.
 
            1); -- State.
 
 
        -- Rollback any active or uncommittable transactions
 
        IF @@TRANCOUNT > 0
 
        BEGIN
 
            ROLLBACK TRANSACTION;
 
        END
 
    END;
 
END;
 
</pre>
 
 
=== References ===
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
| '''Dependency Type
 
| '''Object Type
 
| '''Referenced Object
 
 
|- valign="top"
 
| Data Type
 
| Type
 
| [[dbo.Flag_(type)|dbo.Flag]]
 
 
|- valign="top"
 
| Schema
 
| Schema
 
| [[HumanResources_(schema)|HumanResources]]
 
 
|}
 
 
=== Dependencies ===
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
| '''Reference Type
 
| '''Object Type
 
| '''Referencing Object
 
 
|- valign="top"
 
| Select
 
| View
 
| [[HumanResources.vEmployee_(view)|HumanResources.vEmployee]]
 
 
|- valign="top"
 
| Select
 
| View
 
| [[HumanResources.vEmployeeDepartment_(view)|HumanResources.vEmployeeDepartment]]
 
 
|- valign="top"
 
| Select
 
| View
 
| [[HumanResources.vEmployeeDepartmentHistory_(view)|HumanResources.vEmployeeDepartmentHistory]]
 
 
|- valign="top"
 
| Select
 
| View
 
| [[Sales.vSalesPerson_(view)|Sales.vSalesPerson]]
 
 
|- valign="top"
 
| Select
 
| View
 
| [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]]
 
 
|- valign="top"
 
| Select
 
| Procedure
 
| [[dbo.uspGetEmployeeManagers_(procedure)|dbo.uspGetEmployeeManagers]]
 
 
|- valign="top"
 
| Select
 
| Procedure
 
| [[dbo.uspGetManagerEmployees_(procedure)|dbo.uspGetManagerEmployees]]
 
 
|- valign="top"
 
| Update
 
| Procedure
 
| [[HumanResources.uspUpdateEmployeeHireInfo_(procedure)|HumanResources.uspUpdateEmployeeHireInfo]]
 
 
|- valign="top"
 
| Update
 
| Procedure
 
| [[HumanResources.uspUpdateEmployeeLogin_(procedure)|HumanResources.uspUpdateEmployeeLogin]]
 
 
|- valign="top"
 
| Update
 
| Procedure
 
| [[HumanResources.uspUpdateEmployeePersonalInfo_(procedure)|HumanResources.uspUpdateEmployeePersonalInfo]]
 
 
|- valign="top"
 
| Select
 
| SQL table-valued-function
 
| [[dbo.ufnGetContactInformation_(function)|dbo.ufnGetContactInformation]]
 
 
|}
 
 
 
 
== automatically generated ==
 
== automatically generated ==
  
Line 369: Line 204:
 
| HumanResources.Employee
 
| HumanResources.Employee
 
|- valign="top"
 
|- valign="top"
 +
 
| '''Description
 
| '''Description
 
| Employee information such as salary, department, and title.
 
| Employee information such as salary, department, and title.
 
|-
 
|-
 +
 
|}
 
|}
  
Line 550: Line 387:
 
{| 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"
 +
| '''Referenced Object
 +
| '''Object Type
 
| '''Dependency Type
 
| '''Dependency Type
| '''Object Type
 
| '''Referenced Object
 
  
 
|-
 
|-
 +
| [[dbo.Flag_(type)|dbo.Flag]]
 +
| Type
 
| Data Type
 
| Data Type
| Type
 
| [[dbo.Flag_(type)|dbo.Flag]]
 
 
 
|-
 
|-
 +
| [[.HumanResources_(schema)|.HumanResources]]
 
| Schema
 
| Schema
 
| Schema
 
| Schema
| [[HumanResources_(schema)|HumanResources]]
 
 
 
|}
 
|}
  
Line 569: Line 404:
 
{| 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"
 +
| '''Referencing Object
 +
| '''Object Type
 
| '''Reference Type
 
| '''Reference Type
| '''Object Type
 
| '''Referencing Object
 
  
 
|-
 
|-
 +
| [[HumanResources.vEmployee_(view)|HumanResources.vEmployee]]
 +
| View
 
| Select
 
| Select
 +
|-
 +
| [[HumanResources.vEmployeeDepartment_(view)|HumanResources.vEmployeeDepartment]]
 
| View
 
| View
| [[HumanResources.vEmployee_(view)|HumanResources.vEmployee]]
+
| Select
 
 
 
|-
 
|-
 +
| [[HumanResources.vEmployeeDepartmentHistory_(view)|HumanResources.vEmployeeDepartmentHistory]]
 +
| View
 
| Select
 
| Select
 +
|-
 +
| [[Sales.vSalesPerson_(view)|Sales.vSalesPerson]]
 
| View
 
| View
| [[HumanResources.vEmployeeDepartment_(view)|HumanResources.vEmployeeDepartment]]
+
| Select
 
 
 
|-
 
|-
 +
| [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]]
 +
| View
 
| Select
 
| Select
| View
 
| [[HumanResources.vEmployeeDepartmentHistory_(view)|HumanResources.vEmployeeDepartmentHistory]]
 
 
 
|-
 
|-
 +
| [[dbo.uspGetEmployeeManagers_(procedure)|dbo.uspGetEmployeeManagers]]
 +
| Procedure
 
| Select
 
| Select
| View
 
| [[Sales.vSalesPerson_(view)|Sales.vSalesPerson]]
 
 
 
|-
 
|-
 +
| [[dbo.uspGetManagerEmployees_(procedure)|dbo.uspGetManagerEmployees]]
 +
| Procedure
 
| Select
 
| Select
| View
 
| [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]]
 
 
 
|-
 
|-
| Select
+
| [[HumanResources.uspUpdateEmployeeHireInfo_(procedure)|HumanResources.uspUpdateEmployeeHireInfo]]
 
| Procedure
 
| Procedure
| [[dbo.uspGetEmployeeManagers_(procedure)|dbo.uspGetEmployeeManagers]]
+
| Update
 
 
 
|-
 
|-
| Select
+
| [[HumanResources.uspUpdateEmployeeLogin_(procedure)|HumanResources.uspUpdateEmployeeLogin]]
 
| Procedure
 
| Procedure
| [[dbo.uspGetManagerEmployees_(procedure)|dbo.uspGetManagerEmployees]]
 
 
|-
 
 
| Update
 
| Update
| Procedure
 
| [[HumanResources.uspUpdateEmployeeHireInfo_(procedure)|HumanResources.uspUpdateEmployeeHireInfo]]
 
 
 
|-
 
|-
| Update
+
| [[HumanResources.uspUpdateEmployeePersonalInfo_(procedure)|HumanResources.uspUpdateEmployeePersonalInfo]]
 
| Procedure
 
| Procedure
| [[HumanResources.uspUpdateEmployeeLogin_(procedure)|HumanResources.uspUpdateEmployeeLogin]]
 
 
|-
 
 
| Update
 
| Update
| Procedure
 
| [[HumanResources.uspUpdateEmployeePersonalInfo_(procedure)|HumanResources.uspUpdateEmployeePersonalInfo]]
 
 
 
|-
 
|-
 +
| [[dbo.ufnGetContactInformation_(function)|dbo.ufnGetContactInformation]]
 +
| SQL table-valued-function
 
| Select
 
| Select
| SQL table-valued-function
 
| [[dbo.ufnGetContactInformation_(function)|dbo.ufnGetContactInformation]]
 
 
 
|}
 
|}

Please note that all contributions to dbscript Online Help may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Project:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)