Sales |
04/26/2006 |
PRIMARY |
8 |
24 |
17 |
Sales representative transfers to other sales territories. |
|
|
SalesPersonID |
int |
4 |
|
|
|
|
Primary key for SalesTerritoryHistory records. |
|
|
TerritoryID |
int |
4 |
|
|
|
|
Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID. |
|
|
StartDate |
datetime |
8 |
|
|
|
|
Date the sales representive started work in the territory. |
|
|
EndDate |
datetime |
8 |
|
|
|
|
Date the sales representative left work in the territory. |
|
|
rowguid |
uniqueidentifier |
16 |
|
(newid()) |
|
|
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
|
|
ModifiedDate |
datetime |
8 |
|
(getdate()) |
|
|
Date and time the record was last updated. |
Total: 6 column(s)
Total: 2 index(es)
|
CK_SalesTerritoryHistory_EndDate |
([EndDate]>=[StartDate] OR [EndDate] IS NULL) |
Total: 1 constraint(s)
Total: 2 table(s)
Total: 8 object(s)
CREATE TABLE [SalesTerritoryHistory] (
[SalesPersonID] [int] NOT NULL ,
[TerritoryID] [int] NOT NULL ,
[StartDate] [datetime] NOT NULL ,
[EndDate] [datetime] NULL ,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_SalesTerritoryHistory_rowguid] DEFAULT (newid()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_SalesTerritoryHistory_ModifiedDate] DEFAULT (getdate()),
CONSTRAINT [PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryID] PRIMARY KEY CLUSTERED
(
[SalesPersonID],
[StartDate],
[TerritoryID]
) ON [PRIMARY] ,
CONSTRAINT [FK_SalesTerritoryHistory_SalesPerson_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [SalesPerson] (
[SalesPersonID]
),
CONSTRAINT [FK_SalesTerritoryHistory_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [SalesTerritory] (
[TerritoryID]
),
CONSTRAINT [CK_SalesTerritoryHistory_EndDate] CHECK ([EndDate]>=[StartDate] OR [EndDate] IS NULL)
) ON [PRIMARY]
GO
List of tables