AdventureWorks
| Table Name: | Sales.SalesTerritoryHistory |
| Description: | Sales representative transfers to other sales territories. |
| Primary Keys: | SalesPersonID StartDate TerritoryID |
| Field | Type | Defaults | Nulls? | Comments |
|---|---|---|---|---|
| SalesPersonID | int | None | No | Primary key for SalesTerritoryHistory records. |
| TerritoryID | int | None | No | Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID. |
| StartDate | datetime | None | No | Date the sales representive started work in the territory. |
| EndDate | datetime | None | Yes | Date the sales representative left work in the territory. |
| rowguid | uniqueidentifier | (newid()) | No | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
| ModifiedDate | datetime | (getdate()) | No | Date and time the record was last updated. |
| Index | Clustered? | Unique? | Fields |
|---|---|---|---|
| PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID | Yes | Yes | SalesPersonID StartDate TerritoryID |
| AK_SalesTerritoryHistory_rowguid | No | Yes | rowguid |
| Check Constraint | Text |
|---|---|
| CK_SalesTerritoryHistory_EndDate | ([EndDate]>=[StartDate] OR [EndDate] IS NULL) |
| Internal Foreign Key Constraint | Affected Field | Source Table |
|---|---|---|
| FK_SalesTerritoryHistory_SalesPerson_SalesPersonID | SalesPersonID | Sales.SalesPerson |
| FK_SalesTerritoryHistory_SalesTerritory_TerritoryID | TerritoryID | Sales.SalesTerritory |