Difference between revisions of "Sales.SalesTerritoryHistory (table)"

From dbscript Online Help
Jump to: navigation, search
Line 12: Line 12:
  
  
 +
=== 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 18: Line 19:
 
| '''Nullable
 
| '''Nullable
 
| '''Default
 
| '''Default
| '''Description / PK / Index
+
| '''Description
 
 
 
|- valign="top"
 
|- valign="top"
Line 25: Line 26:
 
| not null
 
| not null
 
|  
 
|  
| Primary key for SalesTerritoryHistory records.<br />PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
+
| Primary key for SalesTerritoryHistory records.
 
|- valign="top"
 
|- valign="top"
 
| TerritoryID
 
| TerritoryID
Line 31: Line 32:
 
| not null
 
| not null
 
|  
 
|  
| Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.<br />PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
+
| Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.
 
|- valign="top"
 
|- valign="top"
 
| StartDate
 
| StartDate
Line 37: Line 38:
 
| not null
 
| not null
 
|  
 
|  
| Date the sales representive started work in the territory.<br />PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
+
| Date the sales representive started work in the territory.
 
|- valign="top"
 
|- valign="top"
 
| EndDate
 
| EndDate
Line 43: Line 44:
 
| null
 
| null
 
|  
 
|  
| Date the sales representative left work in the territory.<br />
+
| Date the sales representative left work in the territory.
 
|- valign="top"
 
|- valign="top"
 
| rowguid
 
| rowguid
Line 49: Line 50:
 
| not null
 
| not null
 
| (newid())
 
| (newid())
| ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.<br />AK_SalesTerritoryHistory_rowguid
+
| ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
 
|- valign="top"
 
|- valign="top"
 
| ModifiedDate
 
| ModifiedDate
Line 55: Line 56:
 
| not null
 
| not null
 
| (getdate())
 
| (getdate())
| Date and time the record was last updated.<br />
+
| 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
 +
|-
 +
| PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
 +
| SalesPersonID, TerritoryID, StartDate
 +
|}
 +
 +
=== Indexes ===
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Index
 +
| '''Type
 +
| '''Columns
 +
 +
|-
 +
| AK_SalesTerritoryHistory_rowguid
 +
| Unique
 +
| rowguid
 +
|}
  
 +
=== Check Constraints ===
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Check Constraint
 +
| '''Expression
 +
| '''Description
 +
 +
|-
 +
| CK_SalesTerritoryHistory_EndDate
 +
| ([EndDate]>=[StartDate] OR [EndDate] IS NULL)
 +
| Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL
 +
|}
  
 +
=== 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 76: Line 112:
 
|}
 
|}
  
 +
=== References ===
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Dependency Type
 +
| '''Object Type
 +
| '''Referenced Object
 +
 +
|-
 +
| Schema
 +
| Schema
 +
| [[Sales_(schema)|Sales]]
 +
 +
|}
  
  

Revision as of 00:06, 3 February 2010

wikibot

Table Sales.SalesTerritoryHistory
Description Sales representative transfers to other sales territories.


Columns

Column Data Type Nullable Default Description
SalesPersonID int not null Primary key for SalesTerritoryHistory records.
TerritoryID int not null Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.
StartDate datetime not null Date the sales representive started work in the territory.
EndDate datetime null Date the sales representative left work in the territory.
rowguid uniqueidentifier not null (newid()) ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDate datetime not null (getdate()) Date and time the record was last updated.

Primary Key

Primary Key Columns
PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID SalesPersonID, TerritoryID, StartDate

Indexes

Index Type Columns
AK_SalesTerritoryHistory_rowguid Unique rowguid

Check Constraints

Check Constraint Expression Description
CK_SalesTerritoryHistory_EndDate ([EndDate]>=[StartDate] OR [EndDate] IS NULL) Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL

Foreign Keys

Relation Column Referenced Column
Sales.SalesPerson SalesPersonID SalesPersonID
Sales.SalesTerritory TerritoryID TerritoryID

References

Dependency Type Object Type Referenced Object
Schema Schema Sales


automatically generated

Table Sales.SalesTerritoryHistory
Description Sales representative transfers to other sales territories.


Column Data Type Nullable Default Description / PK / Index
SalesPersonID int not null Primary key for SalesTerritoryHistory records.
PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
TerritoryID int not null Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.
PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
StartDate datetime not null Date the sales representive started work in the territory.
PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID
EndDate datetime null Date the sales representative left work in the territory.
rowguid uniqueidentifier not null (NEWID()) ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
AK_SalesTerritoryHistory_rowguid
ModifiedDate datetime not null (GETDATE()) Date and time the record was last updated.


Relation Column Referenced Column
Sales.SalesPerson SalesPersonID SalesPersonID
Sales.SalesTerritory TerritoryID TerritoryID


Dependency Type Object Type Referenced Object
Schema Schema Sales