Sales.Customer Table

Information

NameCustomer
SchemaSales
Row Count0
Data Size 
Index Size 
Reserved Size 
Unused Size 
Created29.3.2010. 21:58:18
Modified29.3.2010. 21:58:55

Extended Properties

NameTypeProperty NameValue
CustomerTABLEMS_DescriptionCurrent customer information. Also see the Individual and Store tables.

Columns

PKKeyIdentityNameData TypeAllow NullsCollationReferencesDefaultComputedCompute Expression
   CustomerIDint   
 
 
 
   TerritoryIDint  Sales.SalesTerritory.TerritoryID
 
 
 
   AccountNumbervarchar(10) SQL_Latin1_General_CP1_CI_AS 
 
 
(isnull('AW'+[dbo].[ufnLeadingZeros]([CustomerID]),''))
   CustomerTypenchar(1) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   rowguiduniqueidentifier   
(newid())
 
 
   ModifiedDatedatetime   
(getdate())
 
 

Indexes

NameTypePrimaryUniqueColumns
PK_Customer_CustomerIDClustered  CustomerID
AK_Customer_rowguidNonClustered  rowguid
AK_Customer_AccountNumberNonClustered  AccountNumber
IX_Customer_TerritoryIDNonClustered  TerritoryID

Check Constraints

NameColumnEnabledTrustedExpression
CK_Customer_CustomerTypeCustomerType  (upper([CustomerType])='I' OR upper([CustomerType])='S')

Foreign Key Constraints

NameTypeReferenced Table
FK_Customer_SalesTerritory_TerritoryIDForeign keySales.SalesTerritory

SQL Script

CREATE TABLE [Sales].[Customer] (
    [CustomerID] int NOT NULL IDENTITY,
    [TerritoryID] int NULL,
    [AccountNumber] varchar(10) NOT NULL,
    [CustomerType] nchar(1) NOT NULL,
    [rowguid] uniqueidentifier NOT NULL DEFAULT (newid()),
    [ModifiedDate] datetime NOT NULL DEFAULT (getdate())
);
CREATE UNIQUE INDEX [AK_Customer_rowguid] on [Sales].[Customer]([rowguid]);
CREATE UNIQUE INDEX [AK_Customer_AccountNumber] on [Sales].[Customer]([AccountNumber]);
CREATE INDEX [IX_Customer_TerritoryID] on [Sales].[Customer]([TerritoryID]);