Difference between revisions of "Sales.Customer (table)"
| 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 | + | | '''Description |
|- valign="top" | |- valign="top" | ||
| Line 25: | Line 26: | ||
| not null | | not null | ||
| | | | ||
| − | | Primary key for Customer records. | + | | Primary key for Customer records. |
|- valign="top" | |- valign="top" | ||
| TerritoryID | | TerritoryID | ||
| Line 31: | Line 32: | ||
| 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 38: | ||
| | | | ||
| | | | ||
| − | | 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 44: | ||
| 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 50: | ||
| 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 56: | ||
| 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 | ||
| + | |- | ||
| + | | PK_Customer_CustomerID | ||
| + | | CustomerID | ||
| + | |} | ||
| + | === Indexes === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Index | ||
| + | | '''Type | ||
| + | | '''Columns | ||
| + | |||
| + | |- | ||
| + | | AK_Customer_rowguid | ||
| + | | Unique | ||
| + | | rowguid | ||
| + | |- | ||
| + | | AK_Customer_AccountNumber | ||
| + | | Unique | ||
| + | | AccountNumber | ||
| + | |- | ||
| + | | IX_Customer_TerritoryID | ||
| + | | | ||
| + | | TerritoryID | ||
| + | |} | ||
| + | === Check Constraints === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''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 === | ||
{| 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 72: | Line 116: | ||
|} | |} | ||
| − | + | === 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 141: | ||
|} | |} | ||
| + | === 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]] | ||
| + | |} | ||
| + | |||
| + | === 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 115: | Line 173: | ||
|} | |} | ||
| − | |||
Revision as of 23:07, 2 February 2010
Contents
wikibot
| Table | Sales.Customer |
| Description | Current customer information. Also see the Individual and Store tables. |
Columns
| 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
| Primary Key | Columns |
| PK_Customer_CustomerID | CustomerID |
Indexes
| Index | Type | Columns |
| AK_Customer_rowguid | Unique | rowguid |
| AK_Customer_AccountNumber | Unique | AccountNumber |
| IX_Customer_TerritoryID | TerritoryID |
Check Constraints
| 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
| Relation | Column | Referenced Column |
| Sales.SalesTerritory | TerritoryID | TerritoryID |
Detail Tables
| Detail Table | Column | Referencing Column |
| Sales.CustomerAddress | CustomerID | CustomerID |
| Sales.Individual | CustomerID | CustomerID |
| Sales.SalesOrderHeader | CustomerID | CustomerID |
| Sales.Store | CustomerID | CustomerID |
References
| Dependency Type | Object Type | Referenced Object |
| Schema | Schema | Sales |
Dependencies
| Reference Type | Object Type | Referencing Object |
| Select | View | Sales.vIndividualCustomer |
| Select | View | Sales.vStoreWithDemographics |
automatically generated
| 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 |