Owner: | Sales |
Creation Date: | 04/26/2006 |
Located On: | PRIMARY |
Data Size KB: | 824 |
Index Size KB: | 1176 |
Rows: | 19185 |
Description: | Current customer information. Also see the Individual and Store tables. |
Name | Data Type | Length | NULL | Default | IsIdentity | IsGUID | Description | ||
|
CustomerID | int | 4 |
|
|
|
Primary key for Customer records. | ||
|
|
TerritoryID | int | 4 |
|
|
|
ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. | |
|
AccountNumber | varchar | 10 |
|
|
|
Unique number identifying the customer assigned by the accounting system. | ||
|
CustomerType | nchar | 1 |
|
|
|
Customer type: I = Individual, S = Store | ||
|
rowguid | uniqueidentifier | 16 |
|
(newid()) |
|
|
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. | |
|
ModifiedDate | datetime | 8 |
|
(getdate()) |
|
|
Date and time the record was last updated. |
Name | Seed | Increment | Not for replication | |
|
CustomerID | 1 | 1 |
|
Index | Primary | Unique | Description | |
|
PK_Customer_CustomerID |
|
|
Primary key (clustered) constraint |
|
IX_Customer_TerritoryID |
|
|
Nonclustered index. |
|
AK_Customer_AccountNumber |
|
|
Unique nonclustered index. |
|
AK_Customer_rowguid |
|
|
Unique nonclustered index. Used to support replication samples. |
Name | Expression | |
|
CK_Customer_CustomerType | (upper([CustomerType])='I' OR upper([CustomerType])='S') |
Table | Foreign Key | Primary Key or Unique Constraint | |
|
Sales.SalesTerritory | FK_Customer_SalesTerritory_TerritoryID | PK_SalesTerritory_TerritoryID |
Objects that [Sales].[Customer] depends on
Object Name | Owner | Object Type | Dep Level | |
|
Name | dbo | User Defined type | 1 |
|
ufnLeadingZeros | dbo | Function | 2 |
|
SalesTerritory | Sales | Table | 2 |
Objects that depend on [Sales].[Customer]
Object Name | Owner | Object Type | Dep Level | |
|
CustomerAddress | Sales | Table | 1 |
|
Individual | Sales | Table | 1 |
|
SalesOrderHeader | Sales | Table | 1 |
|
Store | Sales | Table | 1 |
|
vIndividualCustomer | Sales | View | 2 |
|
vIndividualDemographics | Sales | View | 2 |
|
vSalesPersonSalesByFiscalYears | Sales | View | 2 |
|
SalesOrderDetail | Sales | Table | 2 |
|
SalesOrderHeaderSalesReason | Sales | Table | 2 |
|
StoreContact | Sales | Table | 2 |
|
iStore | Sales | Trigger | 2 |
|
iuIndividual | Sales | Trigger | 2 |
|
uSalesOrderHeader | Sales | Trigger | 2 |
|
ufnGetContactInformation | dbo | Function | 3 |
|
vStoreWithDemographics | Sales | View | 3 |
|
iduSalesOrderDetail | Sales | Trigger | 3 |
CREATE TABLE [Customer] (
[CustomerID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[TerritoryID] [int] NULL ,
[AccountNumber] AS (isnull('AW'+[dbo].[ufnLeadingZeros]([CustomerID]),'')) ,
[CustomerType] [nchar] (1) COLLATE Latin1_General_CS_AS NOT NULL ,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Customer_rowguid] DEFAULT (newid()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Customer_ModifiedDate] DEFAULT (getdate()),
CONSTRAINT [PK_Customer_CustomerID] PRIMARY KEY CLUSTERED
(
[CustomerID]
) ON [PRIMARY] ,
CONSTRAINT [FK_Customer_SalesTerritory_TerritoryID] FOREIGN KEY
(
[TerritoryID]
) REFERENCES [SalesTerritory] (
[TerritoryID]
),
CONSTRAINT [CK_Customer_CustomerType] CHECK (upper([CustomerType])='I' OR upper([CustomerType])='S')
) ON [PRIMARY]
GO
See Also
List of tables