Sales.Customer (table)
From dbscript Online Help
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 |
