Properties

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. 

Columns

Name Data Type Length NULL Default IsIdentity IsGUID Description
    CustomerID  int          Primary key for Customer records. 
    TerritoryID  int          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          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    (getdate())      Date and time the record was last updated. 
Total: 6 column(s)

Identity column

Name Seed Increment Not for replication
  CustomerID   

Indexes

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. 
Total: 4 index(es)

Check Constraints

Name Expression
  CK_Customer_CustomerType  (upper([CustomerType])='I' OR upper([CustomerType])='S') 
Total: 1 constraint(s)

Referencing Tables

Table Foreign Key Primary Key or Unique Constraint
  Sales.SalesOrderHeader  FK_SalesOrderHeader_Customer_CustomerID  PK_Customer_CustomerID 
  Sales.Store  FK_Store_Customer_CustomerID  PK_Customer_CustomerID 
  Sales.CustomerAddress  FK_CustomerAddress_Customer_CustomerID  PK_Customer_CustomerID 
  Sales.Individual  FK_Individual_Customer_CustomerID  PK_Customer_CustomerID 
Total: 4 table(s)

Referenced Tables

Table Foreign Key Primary Key or Unique Constraint
  Sales.SalesTerritory  FK_Customer_SalesTerritory_TerritoryID  PK_SalesTerritory_TerritoryID 
Total: 1 table(s)

Objects that [Sales].[Customer] depends on

Object Name Owner Object Type Dep Level
  Name  dbo  User Defined type 
  ufnLeadingZeros  dbo  Function 
  SalesTerritory  Sales  Table 
Total: 3 object(s)

Objects that depend on [Sales].[Customer]

Object Name Owner Object Type Dep Level
  CustomerAddress  Sales  Table 
  Individual  Sales  Table 
  SalesOrderHeader  Sales  Table 
  Store  Sales  Table 
  vIndividualCustomer  Sales  View 
  vIndividualDemographics  Sales  View 
  vSalesPersonSalesByFiscalYears  Sales  View 
  SalesOrderDetail  Sales  Table 
  SalesOrderHeaderSalesReason  Sales  Table 
  StoreContact  Sales  Table 
  iStore  Sales  Trigger 
  iuIndividual  Sales  Trigger 
  uSalesOrderHeader  Sales  Trigger 
  ufnGetContactInformation  dbo  Function 
  vStoreWithDemographics  Sales  View 
  iduSalesOrderDetail  Sales  Trigger 
Total: 16 object(s)

SQL

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