Difference between revisions of "Sales.SalesTerritory (table)"
(14 intermediate revisions by the same user not shown) | |||
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 | ||
| Sales.SalesTerritory | | Sales.SalesTerritory | ||
− | |- | + | |- valign="top" |
+ | | '''Description | ||
+ | | Sales territory lookup table. | ||
|} | |} | ||
− | + | === 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 15: | Line 17: | ||
| '''Nullable | | '''Nullable | ||
| '''Default | | '''Default | ||
− | | ''' | + | | '''Description |
− | + | ||
− | + | |- valign="top" | |
− | |- | ||
| TerritoryID | | TerritoryID | ||
| int | | int | ||
| not null | | not null | ||
| | | | ||
− | | | + | | Primary key for SalesTerritory records. |
− | + | |- valign="top" | |
− | |- | ||
| Name | | Name | ||
| dbo.Name | | dbo.Name | ||
| not null | | not null | ||
| | | | ||
− | | | + | | Sales territory description |
− | + | |- valign="top" | |
− | |- | ||
| CountryRegionCode | | CountryRegionCode | ||
| nvarchar(3) | | nvarchar(3) | ||
| not null | | not null | ||
| | | | ||
− | | | + | | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. |
− | + | |- valign="top" | |
− | |- | ||
| Group | | Group | ||
| nvarchar(50) | | nvarchar(50) | ||
| not null | | not null | ||
| | | | ||
− | | | + | | Geographic area to which the sales territory belong. |
− | + | |- valign="top" | |
− | |- | ||
| SalesYTD | | SalesYTD | ||
| money | | money | ||
| not null | | not null | ||
| ((0.00)) | | ((0.00)) | ||
− | | | + | | Sales in the territory year to date. |
− | + | |- valign="top" | |
− | |- | ||
| SalesLastYear | | SalesLastYear | ||
| money | | money | ||
| not null | | not null | ||
| ((0.00)) | | ((0.00)) | ||
− | | | + | | Sales in the territory the previous year. |
− | + | |- valign="top" | |
− | |- | ||
| CostYTD | | CostYTD | ||
| money | | money | ||
| not null | | not null | ||
| ((0.00)) | | ((0.00)) | ||
− | | | + | | Business costs in the territory year to date. |
− | + | |- valign="top" | |
− | |- | ||
| CostLastYear | | CostLastYear | ||
| money | | money | ||
| not null | | not null | ||
| ((0.00)) | | ((0.00)) | ||
− | | | + | | Business costs in the territory the previous year. |
− | + | |- 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" | |
− | |- | ||
| 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_SalesTerritory_TerritoryID | ||
+ | | TerritoryID | ||
+ | |} | ||
+ | |||
+ | === Indexes === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Index | ||
+ | | '''Type | ||
+ | | '''Columns | ||
+ | |||
+ | |- valign="top" | ||
+ | | AK_SalesTerritory_Name | ||
+ | | Unique | ||
+ | | Name | ||
+ | |- valign="top" | ||
+ | | AK_SalesTerritory_rowguid | ||
+ | | Unique | ||
+ | | rowguid | ||
|} | |} | ||
+ | === Check Constraints === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Check Constraint | ||
+ | | '''Expression | ||
+ | | '''Description | ||
+ | |- valign="top" | ||
+ | | CK_SalesTerritory_CostLastYear | ||
+ | | ([CostLastYear]>=(0.00)) | ||
+ | | Check constraint [CostLastYear] >= (0.00) | ||
+ | |- valign="top" | ||
+ | | CK_SalesTerritory_CostYTD | ||
+ | | ([CostYTD]>=(0.00)) | ||
+ | | Check constraint [CostYTD] >= (0.00) | ||
+ | |- valign="top" | ||
+ | | CK_SalesTerritory_SalesLastYear | ||
+ | | ([SalesLastYear]>=(0.00)) | ||
+ | | Check constraint [SalesLastYear] >= (0.00) | ||
+ | |- valign="top" | ||
+ | | CK_SalesTerritory_SalesYTD | ||
+ | | ([SalesYTD]>=(0.00)) | ||
+ | | Check constraint [SalesYTD] >= (0.00) | ||
+ | |} | ||
+ | === 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 97: | Line 139: | ||
| '''Column | | '''Column | ||
| '''Referencing Column | | '''Referencing Column | ||
− | + | ||
− | |- | + | |- valign="top" |
| [[Sales.Customer_(table)|Sales.Customer]] | | [[Sales.Customer_(table)|Sales.Customer]] | ||
| TerritoryID | | TerritoryID | ||
| TerritoryID | | TerritoryID | ||
− | |- | + | |- valign="top" |
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
| TerritoryID | | TerritoryID | ||
| TerritoryID | | TerritoryID | ||
− | |- | + | |- valign="top" |
| [[Sales.SalesPerson_(table)|Sales.SalesPerson]] | | [[Sales.SalesPerson_(table)|Sales.SalesPerson]] | ||
| TerritoryID | | TerritoryID | ||
| TerritoryID | | TerritoryID | ||
− | |- | + | |- valign="top" |
| [[Sales.SalesTerritoryHistory_(table)|Sales.SalesTerritoryHistory]] | | [[Sales.SalesTerritoryHistory_(table)|Sales.SalesTerritoryHistory]] | ||
| TerritoryID | | TerritoryID | ||
| TerritoryID | | TerritoryID | ||
− | |- | + | |- valign="top" |
| [[Person.StateProvince_(table)|Person.StateProvince]] | | [[Person.StateProvince_(table)|Person.StateProvince]] | ||
| TerritoryID | | TerritoryID | ||
| TerritoryID | | TerritoryID | ||
|} | |} | ||
+ | |||
+ | === 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.Name_(type)|dbo.Name]] | ||
+ | |||
+ | |- valign="top" | ||
+ | | Schema | ||
+ | | Schema | ||
+ | | [[Sales_(schema)|Sales]] | ||
+ | |||
+ | |} | ||
+ | |||
+ | === Dependencies === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Reference Type | ||
+ | | '''Object Type | ||
+ | | '''Referencing Object | ||
+ | |||
+ | | '''Child Type | ||
+ | | '''Child Object | ||
+ | |||
+ | |- valign="top" | ||
+ | | Select | ||
+ | | View | ||
+ | | [[Sales.vSalesPerson_(view)|Sales.vSalesPerson]] | ||
+ | |||
+ | | | ||
+ | | | ||
+ | |- valign="top" | ||
+ | | Select | ||
+ | | View | ||
+ | | [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]] | ||
+ | |||
+ | | | ||
+ | | | ||
+ | |- valign="top" | ||
+ | | Update | ||
+ | | Table | ||
+ | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
+ | |||
+ | | Trigger | ||
+ | | uSalesOrderHeader | ||
+ | |} | ||
+ | |||
+ | |||
== wikivalues == | == wikivalues == | ||
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
− | |- | + | |- valign="top" |
| '''Table Values | | '''Table Values | ||
| Sales.SalesTerritory | | Sales.SalesTerritory | ||
− | |||
|} | |} | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
− | |||
− | |||
| '''TerritoryID | | '''TerritoryID | ||
| '''Name | | '''Name | ||
| '''CountryRegionCode | | '''CountryRegionCode | ||
| '''Group | | '''Group | ||
− | |- | + | |- valign="top" |
− | | 1 | + | |
− | | Northwest | + | | 1 |
− | | US | + | | Northwest |
− | | North America | + | | US |
− | |- | + | | North America |
− | | 2 | + | |- valign="top" |
− | | Northeast | + | |
− | | US | + | | 2 |
− | | North America | + | | Northeast |
− | |- | + | | US |
− | | 3 | + | | North America |
− | | Central | + | |- valign="top" |
− | | US | + | |
− | | North America | + | | 3 |
− | |- | + | | Central |
− | | 4 | + | | US |
− | | Southwest | + | | North America |
− | | US | + | |- valign="top" |
− | | North America | + | |
− | |- | + | | 4 |
− | | 5 | + | | Southwest |
− | | Southeast | + | | US |
− | | US | + | | North America |
− | | North America | + | |- valign="top" |
− | |- | + | |
− | | 6 | + | | 5 |
− | | Canada | + | | Southeast |
− | | CA | + | | US |
− | | North America | + | | North America |
− | |- | + | |- valign="top" |
− | | 7 | + | |
− | | France | + | | 6 |
− | | FR | + | | Canada |
− | | Europe | + | | CA |
− | |- | + | | North America |
− | | 8 | + | |- valign="top" |
− | | Germany | + | |
− | | DE | + | | 7 |
− | | Europe | + | | France |
− | |- | + | | FR |
− | | 9 | + | | Europe |
− | | Australia | + | |- valign="top" |
− | | AU | + | |
− | | Pacific | + | | 8 |
− | |- | + | | Germany |
− | | 10 | + | | DE |
− | | United Kingdom | + | | Europe |
− | | GB | + | |- valign="top" |
− | | Europe | + | |
+ | | 9 | ||
+ | | Australia | ||
+ | | AU | ||
+ | | Pacific | ||
+ | |- valign="top" | ||
+ | |||
+ | | 10 | ||
+ | | United Kingdom | ||
+ | | GB | ||
+ | | Europe | ||
|} | |} | ||
Line 193: | Line 298: | ||
| '''Table | | '''Table | ||
| Sales.SalesTerritory | | Sales.SalesTerritory | ||
− | |- | + | |- valign="top" |
− | |||
| '''Description | | '''Description | ||
| Sales territory lookup table. | | Sales territory lookup table. | ||
|- | |- | ||
− | |||
|} | |} | ||
Line 208: | Line 311: | ||
| '''Nullable | | '''Nullable | ||
| '''Default | | '''Default | ||
− | | '''Description | + | | '''Description / PK / Index |
− | |||
− | |- | + | |- valign="top" |
| TerritoryID | | TerritoryID | ||
| int | | int | ||
| not null | | not null | ||
| | | | ||
− | | Primary key for SalesTerritory records. | + | | Primary key for SalesTerritory records.<br />PK_SalesTerritory_TerritoryID |
− | + | |- valign="top" | |
− | |- | ||
| Name | | Name | ||
| Name | | Name | ||
| not null | | not null | ||
| | | | ||
− | | Sales territory description | + | | Sales territory description<br />AK_SalesTerritory_Name |
− | + | |- valign="top" | |
− | |- | ||
| CountryRegionCode | | CountryRegionCode | ||
| nvarchar(3) | | nvarchar(3) | ||
| not null | | not null | ||
| | | | ||
− | | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. | + | | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. <br /> |
− | + | |- valign="top" | |
− | |- | ||
| Group | | Group | ||
| nvarchar(50) | | nvarchar(50) | ||
| not null | | not null | ||
| | | | ||
− | | Geographic area to which the sales territory belong. | + | | Geographic area to which the sales territory belong.<br /> |
− | + | |- valign="top" | |
− | |- | ||
| SalesYTD | | SalesYTD | ||
| money | | money | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Sales in the territory year to date. | + | | Sales in the territory year to date.<br /> |
− | + | |- valign="top" | |
− | |- | ||
| SalesLastYear | | SalesLastYear | ||
| money | | money | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Sales in the territory the previous year. | + | | Sales in the territory the previous year.<br /> |
− | + | |- valign="top" | |
− | |- | ||
| CostYTD | | CostYTD | ||
| money | | money | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Business costs in the territory year to date. | + | | Business costs in the territory year to date.<br /> |
− | + | |- valign="top" | |
− | |- | ||
| CostLastYear | | CostLastYear | ||
| money | | money | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Business costs in the territory the previous year. | + | | Business costs in the territory the previous year.<br /> |
− | + | |- 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. | + | | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.<br />AK_SalesTerritory_rowguid |
− | + | |- valign="top" | |
− | |- | ||
| ModifiedDate | | ModifiedDate | ||
| datetime | | datetime | ||
| not null | | not null | ||
| (GETDATE()) | | (GETDATE()) | ||
− | | Date and time the record was last updated. | + | | Date and time the record was last updated.<br /> |
− | |||
|} | |} | ||
Line 311: | Line 403: | ||
| TerritoryID | | TerritoryID | ||
| TerritoryID | | TerritoryID | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Dependency Type | ||
+ | | '''Object Type | ||
+ | | '''Referenced Object | ||
+ | |||
+ | |- | ||
+ | | Data Type | ||
+ | | Type | ||
+ | | [[dbo.Name_(type)|dbo.Name]] | ||
+ | |||
+ | |- | ||
+ | | Schema | ||
+ | | Schema | ||
+ | | [[Sales_(schema)|Sales]] | ||
+ | |||
+ | |} | ||
+ | |||
+ | |||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Reference Type | ||
+ | | '''Object Type | ||
+ | | '''Referencing Object | ||
+ | |||
+ | | '''Child Type | ||
+ | | '''Child Object | ||
+ | |||
+ | |- | ||
+ | | Select | ||
+ | | View | ||
+ | | [[Sales.vSalesPerson_(view)|Sales.vSalesPerson]] | ||
+ | |||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | Select | ||
+ | | View | ||
+ | | [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]] | ||
+ | |||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | Update | ||
+ | | Table | ||
+ | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
+ | |||
+ | | Trigger | ||
+ | | uSalesOrderHeader | ||
|} | |} |
Latest revision as of 09:56, 27 August 2011
Contents
wikibot[edit]
Table | Sales.SalesTerritory |
Description | Sales territory lookup table. |
Columns[edit]
Column | Data Type | Nullable | Default | Description |
TerritoryID | int | not null | Primary key for SalesTerritory records. | |
Name | dbo.Name | not null | Sales territory description | |
CountryRegionCode | nvarchar(3) | not null | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. | |
Group | nvarchar(50) | not null | Geographic area to which the sales territory belong. | |
SalesYTD | money | not null | ((0.00)) | Sales in the territory year to date. |
SalesLastYear | money | not null | ((0.00)) | Sales in the territory the previous year. |
CostYTD | money | not null | ((0.00)) | Business costs in the territory year to date. |
CostLastYear | money | not null | ((0.00)) | Business costs in the territory the previous year. |
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[edit]
Primary Key | Columns |
PK_SalesTerritory_TerritoryID | TerritoryID |
Indexes[edit]
Index | Type | Columns |
AK_SalesTerritory_Name | Unique | Name |
AK_SalesTerritory_rowguid | Unique | rowguid |
Check Constraints[edit]
Check Constraint | Expression | Description |
CK_SalesTerritory_CostLastYear | ([CostLastYear]>=(0.00)) | Check constraint [CostLastYear] >= (0.00) |
CK_SalesTerritory_CostYTD | ([CostYTD]>=(0.00)) | Check constraint [CostYTD] >= (0.00) |
CK_SalesTerritory_SalesLastYear | ([SalesLastYear]>=(0.00)) | Check constraint [SalesLastYear] >= (0.00) |
CK_SalesTerritory_SalesYTD | ([SalesYTD]>=(0.00)) | Check constraint [SalesYTD] >= (0.00) |
Detail Tables[edit]
Detail Table | Column | Referencing Column |
Sales.Customer | TerritoryID | TerritoryID |
Sales.SalesOrderHeader | TerritoryID | TerritoryID |
Sales.SalesPerson | TerritoryID | TerritoryID |
Sales.SalesTerritoryHistory | TerritoryID | TerritoryID |
Person.StateProvince | TerritoryID | TerritoryID |
References[edit]
Dependency Type | Object Type | Referenced Object |
Data Type | Type | dbo.Name |
Schema | Schema | Sales |
Dependencies[edit]
Reference Type | Object Type | Referencing Object | Child Type | Child Object |
Select | View | Sales.vSalesPerson | ||
Select | View | Sales.vSalesPersonSalesByFiscalYears | ||
Update | Table | Sales.SalesOrderHeader | Trigger | uSalesOrderHeader |
wikivalues[edit]
Table Values | Sales.SalesTerritory |
TerritoryID | Name | CountryRegionCode | Group |
1 | Northwest | US | North America |
2 | Northeast | US | North America |
3 | Central | US | North America |
4 | Southwest | US | North America |
5 | Southeast | US | North America |
6 | Canada | CA | North America |
7 | France | FR | Europe |
8 | Germany | DE | Europe |
9 | Australia | AU | Pacific |
10 | United Kingdom | GB | Europe |
automatically generated[edit]
Table | Sales.SalesTerritory |
Description | Sales territory lookup table. |
Column | Data Type | Nullable | Default | Description / PK / Index |
TerritoryID | int | not null | Primary key for SalesTerritory records. PK_SalesTerritory_TerritoryID | |
Name | Name | not null | Sales territory description AK_SalesTerritory_Name | |
CountryRegionCode | nvarchar(3) | not null | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. | |
Group | nvarchar(50) | not null | Geographic area to which the sales territory belong. | |
SalesYTD | money | not null | (0.00) | Sales in the territory year to date. |
SalesLastYear | money | not null | (0.00) | Sales in the territory the previous year. |
CostYTD | money | not null | (0.00) | Business costs in the territory year to date. |
CostLastYear | money | not null | (0.00) | Business costs in the territory the previous year. |
rowguid | uniqueidentifier | not null | (NEWID()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. AK_SalesTerritory_rowguid |
ModifiedDate | datetime | not null | (GETDATE()) | Date and time the record was last updated. |
Detail Table | Column | Referencing Column |
Sales.Customer | TerritoryID | TerritoryID |
Sales.SalesOrderHeader | TerritoryID | TerritoryID |
Sales.SalesPerson | TerritoryID | TerritoryID |
Sales.SalesTerritoryHistory | TerritoryID | TerritoryID |
Person.StateProvince | TerritoryID | TerritoryID |
Dependency Type | Object Type | Referenced Object |
Data Type | Type | dbo.Name |
Schema | Schema | Sales |
Reference Type | Object Type | Referencing Object | Child Type | Child Object |
Select | View | Sales.vSalesPerson | ||
Select | View | Sales.vSalesPersonSalesByFiscalYears | ||
Update | Table | Sales.SalesOrderHeader | Trigger | uSalesOrderHeader |