Sales.Customer (table)

From dbscript Online Help
Jump to: navigation, search

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