Tables SQL 2005 Adventure Works OLTP

Sales.Customer

Object type: Table

Current customer information. Also see the Individual and Store tables.

Columns 

Name  Data type  Nullable  Description 
CustomerID  int  No Column has identity seed value of 1 with a step value of 1.
Primary key for Customer records. 
TerritoryID  int  Yes ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. 
AccountNumber  ISNULL('AW' + [dbo].[ufnLeadingZeros](CustomerID) , '')  Yes Unique number identifying the customer assigned by the accounting system. 
CustomerType  nchar(1)  No Customer type: I = Individual, S = Store 
rowguid  uniqueidentifier  No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. 
ModifiedDate  datetime  No Default value: GETDATE()
Date and time the record was last updated. 

Constraints 

Name  Type  Columns  Description 
DF_Customer_rowguid  DEFAULT  rowguid  Value: NEWID()
Default constraint value of NEWID() 
DF_Customer_ModifiedDate  DEFAULT  ModifiedDate  Value: GETDATE()
Default constraint value of GETDATE() 
CK_Customer_CustomerType  CHECK  N/A  Value: (UPPER([CustomerType]) IN ('S', 'I') )
Check constraint [CustomerType]='I' OR [CustomerType]='i' OR [CustomerType]='S' OR [CustomerType]='s' 
PK_Customer_CustomerID  PRIMARY KEY  CustomerID  Clustered index created by a primary key constraint. 
FK_Customer_SalesTerritory_TerritoryID  FOREIGN KEY  TerritoryID  Reference table: Sales.SalesTerritory
Foreign key constraint referencing SalesTerritory.TerritoryID. 

Indices 

Name  Description 
AK_Customer_AccountNumber  Unique nonclustered index. 
AK_Customer_rowguid  Unique nonclustered index. Used to support replication samples. 
IX_Customer_TerritoryID  Nonclustered index. 

Triggers 

Name  Description 
Sales.uCustomer  AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date. 

Linked tables 

Name  Description 
Sales.CustomerAddress  Cross-reference table mapping customers to their address(es). 
Sales.Individual  Demographic data about customers that purchase Adventure Works products online. 
Sales.SalesOrderHeader  General sales order information. 
Sales.Store  Customers (resellers) of Adventure Works products. 

Accessed by 

Name  Description 
Product Line Sales  Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links. 
Sales.vIndividual  Individual customers (names and addresses) that purchase Adventure Works Cycles products online. 
Sales.vStoreWithDemographics  Stores (names and addresses) that sell Adventure Works Cycles products to consumers. 

Modified by 

Name  Description 
Sales.uCustomer  AFTER UPDATE trigger setting the ModifiedDate column in the Customer table to the current date. 

Applies to

Tables | User
The AdventureWorks database sample was developed by Microsoft Corporation, copyright 2005. SQL Server is a trademark of Microsoft Corporation

Document was prepared on: Thursday, April 05, 2007
Help compiled by DBDocumentor, a Pikauba Software product. All rights reserved.