Difference between revisions of "Sales.Customer (table)"
(2 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.Customer | | Sales.Customer | ||
Line 8: | Line 8: | ||
| '''Description | | '''Description | ||
| Current customer information. Also see the Individual and Store tables. | | Current customer information. Also see the Individual and Store tables. | ||
− | |||
|} | |} | ||
− | + | === 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 17: | ||
| '''Nullable | | '''Nullable | ||
| '''Default | | '''Default | ||
− | | '''Description | + | | '''Description |
− | + | ||
|- valign="top" | |- valign="top" | ||
| CustomerID | | CustomerID | ||
Line 25: | Line 24: | ||
| not null | | not null | ||
| | | | ||
− | | Primary key for Customer records. | + | | Primary key for Customer records. |
|- valign="top" | |- valign="top" | ||
| TerritoryID | | TerritoryID | ||
Line 31: | Line 30: | ||
| null | | null | ||
| | | | ||
− | | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. | + | | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. |
|- valign="top" | |- valign="top" | ||
| AccountNumber | | AccountNumber | ||
Line 37: | Line 36: | ||
| | | | ||
| | | | ||
− | | Unique number identifying the customer assigned by the accounting system. | + | | Unique number identifying the customer assigned by the accounting system. |
|- valign="top" | |- valign="top" | ||
| CustomerType | | CustomerType | ||
Line 43: | Line 42: | ||
| not null | | not null | ||
| | | | ||
− | | Customer type: I = Individual, S = Store | + | | Customer type: I = Individual, S = Store |
|- valign="top" | |- valign="top" | ||
| rowguid | | rowguid | ||
Line 49: | Line 48: | ||
| 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. |
|- valign="top" | |- valign="top" | ||
| ModifiedDate | | ModifiedDate | ||
Line 55: | Line 54: | ||
| not null | | not null | ||
| (getdate()) | | (getdate()) | ||
− | | Date and time the record was last updated. | + | | 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_Customer_CustomerID | ||
+ | | CustomerID | ||
+ | |} | ||
+ | === Indexes === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Index | ||
+ | | '''Type | ||
+ | | '''Columns | ||
+ | |- valign="top" | ||
+ | | AK_Customer_AccountNumber | ||
+ | | Unique | ||
+ | | AccountNumber | ||
+ | |- valign="top" | ||
+ | | AK_Customer_rowguid | ||
+ | | Unique | ||
+ | | rowguid | ||
+ | |- valign="top" | ||
+ | | IX_Customer_TerritoryID | ||
+ | | | ||
+ | | TerritoryID | ||
+ | |} | ||
+ | |||
+ | === Check Constraints === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Check Constraint | ||
+ | | '''Expression | ||
+ | | '''Description | ||
+ | |||
+ | |- valign="top" | ||
+ | | CK_Customer_CustomerType | ||
+ | | (upper([CustomerType])='I' OR upper([CustomerType])='S') | ||
+ | | Check constraint [CustomerType]='I' OR [CustomerType]='i' OR [CustomerType]='S' OR [CustomerType]='s' | ||
+ | |} | ||
+ | |||
+ | === 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 65: | Line 107: | ||
| '''Column | | '''Column | ||
| '''Referenced Column | | '''Referenced Column | ||
− | + | ||
− | |- | + | |- valign="top" |
| [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]] | | [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]] | ||
| TerritoryID | | TerritoryID | ||
Line 72: | Line 114: | ||
|} | |} | ||
− | + | === 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 78: | Line 120: | ||
| '''Column | | '''Column | ||
| '''Referencing Column | | '''Referencing Column | ||
− | + | ||
− | |- | + | |- valign="top" |
| [[Sales.CustomerAddress_(table)|Sales.CustomerAddress]] | | [[Sales.CustomerAddress_(table)|Sales.CustomerAddress]] | ||
| CustomerID | | CustomerID | ||
| CustomerID | | CustomerID | ||
− | |- | + | |- valign="top" |
| [[Sales.Individual_(table)|Sales.Individual]] | | [[Sales.Individual_(table)|Sales.Individual]] | ||
| CustomerID | | CustomerID | ||
| CustomerID | | CustomerID | ||
− | |- | + | |- valign="top" |
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
| CustomerID | | CustomerID | ||
| CustomerID | | CustomerID | ||
− | |- | + | |- valign="top" |
| [[Sales.Store_(table)|Sales.Store]] | | [[Sales.Store_(table)|Sales.Store]] | ||
| CustomerID | | CustomerID | ||
Line 97: | Line 139: | ||
|} | |} | ||
+ | === References === | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Dependency Type | ||
+ | | '''Object Type | ||
+ | | '''Referenced Object | ||
+ | |||
+ | |- valign="top" | ||
+ | | Schema | ||
+ | | Schema | ||
+ | | [[Sales_(schema)|Sales]] | ||
+ | |} | ||
+ | |||
+ | === Dependencies === | ||
{| 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 104: | Line 160: | ||
| '''Referencing Object | | '''Referencing Object | ||
− | |- | + | |- valign="top" |
| Select | | Select | ||
| View | | View | ||
| [[Sales.vIndividualCustomer_(view)|Sales.vIndividualCustomer]] | | [[Sales.vIndividualCustomer_(view)|Sales.vIndividualCustomer]] | ||
− | |- | + | |- valign="top" |
| Select | | Select | ||
| View | | View | ||
Line 115: | Line 171: | ||
|} | |} | ||
− | |||
Latest revision as of 10:56, 27 August 2011
Contents
wikibot[edit]
Table | Sales.Customer |
Description | Current customer information. Also see the Individual and Store tables. |
Columns[edit]
Column | Data Type | Nullable | Default | Description |
CustomerID | int | not null | Primary key for Customer records. | |
TerritoryID | int | null | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. | |
AccountNumber | Unique number identifying the customer assigned by the accounting system. | |||
CustomerType | nchar(1) | not null | Customer type: I = Individual, S = Store | |
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_Customer_CustomerID | CustomerID |
Indexes[edit]
Index | Type | Columns |
AK_Customer_AccountNumber | Unique | AccountNumber |
AK_Customer_rowguid | Unique | rowguid |
IX_Customer_TerritoryID | TerritoryID |
Check Constraints[edit]
Check Constraint | Expression | Description |
CK_Customer_CustomerType | (upper([CustomerType])='I' OR upper([CustomerType])='S') | Check constraint [CustomerType]='I' OR [CustomerType]='i' OR [CustomerType]='S' OR [CustomerType]='s' |
Foreign Keys[edit]
Relation | Column | Referenced Column |
Sales.SalesTerritory | TerritoryID | TerritoryID |
Detail Tables[edit]
Detail Table | Column | Referencing Column |
Sales.CustomerAddress | CustomerID | CustomerID |
Sales.Individual | CustomerID | CustomerID |
Sales.SalesOrderHeader | CustomerID | CustomerID |
Sales.Store | CustomerID | CustomerID |
References[edit]
Dependency Type | Object Type | Referenced Object |
Schema | Schema | Sales |
Dependencies[edit]
Reference Type | Object Type | Referencing Object |
Select | View | Sales.vIndividualCustomer |
Select | View | Sales.vStoreWithDemographics |
automatically generated[edit]
Table | Sales.Customer |
Description | Current customer information. Also see the Individual and Store tables. |
Column | Data Type | Nullable | Default | Description / PK / Index |
CustomerID | int | not null | Primary key for Customer records. PK_Customer_CustomerID | |
TerritoryID | int | null | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. IX_Customer_TerritoryID | |
AccountNumber | Unique number identifying the customer assigned by the accounting system. AK_Customer_AccountNumber | |||
CustomerType | nchar(1) | not null | Customer type: I = Individual, S = Store | |
rowguid | uniqueidentifier | not null | (NEWID()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. AK_Customer_rowguid |
ModifiedDate | datetime | not null | (GETDATE()) | Date and time the record was last updated. |
Relation | Column | Referenced Column |
Sales.SalesTerritory | TerritoryID | TerritoryID |
Detail Table | Column | Referencing Column |
Sales.CustomerAddress | CustomerID | CustomerID |
Sales.Individual | CustomerID | CustomerID |
Sales.SalesOrderHeader | CustomerID | CustomerID |
Sales.Store | CustomerID | CustomerID |
Dependency Type | Object Type | Referenced Object |
Schema | Schema | Sales |
Reference Type | Object Type | Referencing Object |
Select | View | Sales.vIndividualCustomer |
Select | View | Sales.vStoreWithDemographics |