Table: [AdventureWorks2016CTP3].[HumanResources].[EmployeeDepartmentHistory]

CollapseAll image

Collapse image Table properties


Name  Value 
 Schema  [HumanResources]
 Owner  [dbo]
 Table is replicated   
 Creation date  23.10.2015
 ID  1765581328
 Located on  PRIMARY
 Data size KB  16 KB
 Index size KB  48 KB
 Rows  296
 ChangeTrackingEnabled   
 FileStreamFileGroup   
 FileStreamPartitionScheme   
 LockEscalation  TABLE
 TrackColumnsUpdatedEnabled   
 Table is filetable   
 Filetable directory   
 Filetable collate   
 Filetable primary key  [PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID]
 Filetable streamid unique   
 Filetable fullpath unique   
 Filetable is enabled   
 Is memory optimized   
 Durability  SCHEMA_AND_DATA

Collapse image Creation options


Name  Value 
QUOTED_IDENTIFIER ON
ANSI_NULLS ON
ANSI_PADDING OFF

Collapse image Columns


    Name  Description  Data type  Max length  Nullable  Default IsGUID  SPARSE Computed value
Primary key Foreign key BusinessEntityID     int 4        
Primary key Foreign key DepartmentID     smallint 2        
Primary key Foreign key ShiftID     tinyint 1        
Primary key   StartDate     date 3        
    EndDate     date 3      
    ModifiedDate     datetime 8   (getdate())    
Total: 6 column(s)

Collapse image Indexes


Index  Description  Primary  Unique  Size KB 
[PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID] BusinessEntityID   64 0
[IX_EmployeeDepartmentHistory_DepartmentID] DepartmentID       16 0
[IX_EmployeeDepartmentHistory_ShiftID] ShiftID       16 0
Total: 3 Index/indexes

Collapse image Columnstore indexes


No columnstore indexes exist

Collapse image Check constraints


Name  Expression 
CK_EmployeeDepartmentHistory_EndDate ([EndDate]>=[StartDate] OR [EndDate] IS NULL)

Collapse image Referenced tables


Table  Primary key or unique constraint  Foreign key 
[HumanResources].[Department] PK_Department_DepartmentID FK_EmployeeDepartmentHistory_Department_DepartmentID
[HumanResources].[Employee] PK_Employee_BusinessEntityID FK_EmployeeDepartmentHistory_Employee_BusinessEntityID
[HumanResources].[Shift] PK_Shift_ShiftID FK_EmployeeDepartmentHistory_Shift_ShiftID
Total: 3 table(s)

Collapse image Triggers


Name  Schema  Description  Instead 
of 
For 
insert 
For 
update 
For 
delete 
Table/view 
[HumanResources].[tr_i_AUDIT_EmployeeDepartmentHistory] [HumanResources]     For Insert     [HumanResources].[EmployeeDepartmentHistory]
[HumanResources].[tr_u_AUDIT_EmployeeDepartmentHistory] [HumanResources]       For Update   [HumanResources].[EmployeeDepartmentHistory]
[HumanResources].[tr_d_AUDIT_EmployeeDepartmentHistory] [HumanResources]         For Delete [HumanResources].[EmployeeDepartmentHistory]
Total: 3 triggers(s)

Collapse image Objects that depend on [HumanResources].[EmployeeDepartmentHistory]


Object name Object type Dep level
[HumanResources].[tr_d_AUDIT_EmployeeDepartmentHistory] Trigger 1
[HumanResources].[tr_i_AUDIT_EmployeeDepartmentHistory] Trigger 1
[HumanResources].[tr_u_AUDIT_EmployeeDepartmentHistory] Trigger 1
[HumanResources].[vEmployeeDepartment] View 1
[HumanResources].[vEmployeeDepartmentHistory] View 1
Total 5 object(s)

Collapse image Objects that [HumanResources].[EmployeeDepartmentHistory] depends on


Object name Object type Dep level
[HumanResources] Schema 1
[HumanResources].[Department] Table 1
[HumanResources].[Employee] Table 1
[HumanResources].[Shift] Table 1
Total 4 object(s)

Collapse image Extended properties


Name  Value 
MS_Description Employee department transfers.

Collapse image Table options


Name  Value 
Pintable OFF
Table lock on bulk load OFF
Insert row lock OFF
Text in row 0
Large value types out of row OFF

Collapse image SQL


SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING OFF
GO
CREATE TABLE [HumanResources].[EmployeeDepartmentHistory] (
        [BusinessEntityID]     [int] NOT NULL,
        [DepartmentID]         [smallint] NOT NULL,
        [ShiftID]              [tinyint] NOT NULL,
        [StartDate]            [date] NOT NULL,
        [EndDate]              [date] NULL,
        [ModifiedDate]         [datetime] NOT NULL,
        CONSTRAINT [PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID]
        PRIMARY KEY
        CLUSTERED
        ([BusinessEntityID], [StartDate], [DepartmentID], [ShiftID])
    ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key (clustered) constraint', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'CONSTRAINT', N'PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Clustered index created by a primary key constraint.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'INDEX', N'PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID'
GO
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    ADD
    CONSTRAINT [CK_EmployeeDepartmentHistory_EndDate]
    CHECK
    ([EndDate]>=[StartDate] OR [EndDate] IS NULL)
GO
EXEC sp_addextendedproperty N'MS_Description', N'Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NUL', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'CONSTRAINT', N'CK_EmployeeDepartmentHistory_EndDate'
GO
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
CHECK CONSTRAINT [CK_EmployeeDepartmentHistory_EndDate]
GO
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    ADD
    CONSTRAINT [DF_EmployeeDepartmentHistory_ModifiedDate]
    DEFAULT (getdate()) FOR [ModifiedDate]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default constraint value of GETDATE()', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'CONSTRAINT', N'DF_EmployeeDepartmentHistory_ModifiedDate'
GO
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    WITH CHECK
    ADD CONSTRAINT [FK_EmployeeDepartmentHistory_Department_DepartmentID]
    FOREIGN KEY ([DepartmentID]) REFERENCES [HumanResources].[Department] ([DepartmentID])
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    CHECK CONSTRAINT [FK_EmployeeDepartmentHistory_Department_DepartmentID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Department.DepartmentID.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'CONSTRAINT', N'FK_EmployeeDepartmentHistory_Department_DepartmentID'
GO
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    WITH CHECK
    ADD CONSTRAINT [FK_EmployeeDepartmentHistory_Employee_BusinessEntityID]
    FOREIGN KEY ([BusinessEntityID]) REFERENCES [HumanResources].[Employee] ([BusinessEntityID])
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    CHECK CONSTRAINT [FK_EmployeeDepartmentHistory_Employee_BusinessEntityID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Employee.EmployeeID.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'CONSTRAINT', N'FK_EmployeeDepartmentHistory_Employee_BusinessEntityID'
GO
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    WITH CHECK
    ADD CONSTRAINT [FK_EmployeeDepartmentHistory_Shift_ShiftID]
    FOREIGN KEY ([ShiftID]) REFERENCES [HumanResources].[Shift] ([ShiftID])
ALTER TABLE [HumanResources].[EmployeeDepartmentHistory]
    CHECK CONSTRAINT [FK_EmployeeDepartmentHistory_Shift_ShiftID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Shift.ShiftID', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'CONSTRAINT', N'FK_EmployeeDepartmentHistory_Shift_ShiftID'
GO
CREATE NONCLUSTERED INDEX [IX_EmployeeDepartmentHistory_DepartmentID]
    ON [HumanResources].[EmployeeDepartmentHistory] ([DepartmentID])
    ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Nonclustered index.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'INDEX', N'IX_EmployeeDepartmentHistory_DepartmentID'
GO
CREATE NONCLUSTERED INDEX [IX_EmployeeDepartmentHistory_ShiftID]
    ON [HumanResources].[EmployeeDepartmentHistory] ([ShiftID])
    ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Nonclustered index.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'INDEX', N'IX_EmployeeDepartmentHistory_ShiftID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Employee identification number. Foreign key to Employee.BusinessEntityID.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'COLUMN', N'BusinessEntityID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Department in which the employee worked including currently. Foreign key to Department.DepartmentID.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'COLUMN', N'DepartmentID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date the employee left the department. NULL = Current department.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'COLUMN', N'EndDate'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date and time the record was last updated.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'COLUMN', N'ModifiedDate'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'COLUMN', N'ShiftID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date the employee started work in the department.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', 'COLUMN', N'StartDate'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Employee department transfers.', 'SCHEMA', N'HumanResources', 'TABLE', N'EmployeeDepartmentHistory', NULL, NULL
GO

Collapse image See also


List of tables