Table: [AdventureWorks2016CTP3].[Sales].[Customer]

CollapseAll image

Collapse image Table properties


Name  Value 
 Schema  [Sales]
 Owner  [dbo]
 Table is replicated   
 Creation date  23.10.2015
 ID  1317579732
 Located on  PRIMARY
 Data size KB  968 KB
 Index size KB  1328 KB
 Rows  19820
 ChangeTrackingEnabled   
 FileStreamFileGroup   
 FileStreamPartitionScheme   
 LockEscalation  TABLE
 TrackColumnsUpdatedEnabled   
 Table is filetable   
 Filetable directory   
 Filetable collate   
 Filetable primary key  [PK_Customer_CustomerID]
 Filetable streamid unique   
 Filetable fullpath unique   
 Filetable is enabled   
 Is memory optimized   
 Durability  SCHEMA_AND_DATA

Collapse image Creation options


Name  Value 
QUOTED_IDENTIFIER ON
ANSI_NULLS ON
ANSI_PADDING ON

Collapse image Columns


      Name  Description  Data type  Max length  Nullable  Default IsGUID  SPARSE Computed value
Primary key Identity   CustomerID     int 4        
    Foreign key PersonID     int 4      
    Foreign key StoreID     int 4      
    Foreign key TerritoryID     int 4      
      AccountNumber   True varchar 10         (isnull('AW'+[dbo].[ufnLeadingZeros]([CustomerID]),''))
      rowguid     uniqueidentifier 16   (newid())  
      ModifiedDate     datetime 8   (getdate())    
Total: 7 column(s)

Collapse image Indexes


Index  Description  Primary  Unique  Size KB 
[PK_Customer_CustomerID] CustomerID   2296 0
[AK_Customer_AccountNumber] AccountNumber     488 0
[AK_Customer_rowguid] rowguid     528 0
[IX_Customer_TerritoryID] TerritoryID       296 0
Total: 4 Index/indexes

Collapse image Columnstore indexes


No columnstore indexes exist

Collapse image Identity column


  Name  Seed  Increment  Not for replication 
 CustomerID   1   1 

Collapse image Referencing tables


Table  Foreign key  Primary key or unique constraint 
[Sales].[SalesOrderHeader] FK_SalesOrderHeader_Customer_CustomerID PK_Customer_CustomerID
Total: 1 table(s)

Collapse image Referenced tables


Table  Primary key or unique constraint  Foreign key 
[Person].[Person] PK_Person_BusinessEntityID FK_Customer_Person_PersonID
[Sales].[SalesTerritory] PK_SalesTerritory_TerritoryID FK_Customer_SalesTerritory_TerritoryID
[Sales].[Store] PK_Store_BusinessEntityID FK_Customer_Store_StoreID
Total: 3 table(s)

Collapse image Objects that depend on [Sales].[Customer]


Object name Object type Dep level
[Sales].[SalesOrderHeader] Table 1
[Sales].[iduSalesOrderDetail] Trigger 1
[dbo].[ufnGetContactInformation] Function 1
[Sales].[vIndividualCustomer] View 1
Total 4 object(s)

Collapse image Objects that [Sales].[Customer] depends on


Object name Object type Dep level
[Sales] Schema 1
[Person].[Person] Table 1
[Sales].[SalesTerritory] Table 1
[Sales].[Store] Table 1
[dbo].[ufnLeadingZeros] Function 1
Total 5 object(s)

Collapse image Extended properties


Name  Value 
MS_Description Current customer information. Also see the Person and Store tables.

Collapse image Table options


Name  Value 
Pintable OFF
Table lock on bulk load OFF
Insert row lock OFF
Text in row 0
Large value types out of row OFF

Collapse image SQL


SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
CREATE TABLE [Sales].[Customer] (
        [CustomerID]        [int] IDENTITY(1, 1) NOT FOR REPLICATION NOT NULL,
        [PersonID]          [int] NULL,
        [StoreID]           [int] NULL,
        [TerritoryID]       [int] NULL,
        [AccountNumber]     AS (isnull('AW'+[dbo].[ufnLeadingZeros]([CustomerID]),'')),
        [rowguid]           [uniqueidentifier] NOT NULL ROWGUIDCOL,
        [ModifiedDate]      [datetime] NOT NULL,
        CONSTRAINT [PK_Customer_CustomerID]
        PRIMARY KEY
        CLUSTERED
        ([CustomerID])
    ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key (clustered) constraint', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'CONSTRAINT', N'PK_Customer_CustomerID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Clustered index created by a primary key constraint.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'INDEX', N'PK_Customer_CustomerID'
GO
ALTER TABLE [Sales].[Customer]
    ADD
    CONSTRAINT [DF_Customer_ModifiedDate]
    DEFAULT (getdate()) FOR [ModifiedDate]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default constraint value of GETDATE()', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'CONSTRAINT', N'DF_Customer_ModifiedDate'
GO
ALTER TABLE [Sales].[Customer]
    ADD
    CONSTRAINT [DF_Customer_rowguid]
    DEFAULT (newid()) FOR [rowguid]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default constraint value of NEWID()', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'CONSTRAINT', N'DF_Customer_rowguid'
GO
ALTER TABLE [Sales].[Customer]
    WITH CHECK
    ADD CONSTRAINT [FK_Customer_Person_PersonID]
    FOREIGN KEY ([PersonID]) REFERENCES [Person].[Person] ([BusinessEntityID])
ALTER TABLE [Sales].[Customer]
    CHECK CONSTRAINT [FK_Customer_Person_PersonID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Person.BusinessEntityID.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'CONSTRAINT', N'FK_Customer_Person_PersonID'
GO
ALTER TABLE [Sales].[Customer]
    WITH CHECK
    ADD CONSTRAINT [FK_Customer_SalesTerritory_TerritoryID]
    FOREIGN KEY ([TerritoryID]) REFERENCES [Sales].[SalesTerritory] ([TerritoryID])
ALTER TABLE [Sales].[Customer]
    CHECK CONSTRAINT [FK_Customer_SalesTerritory_TerritoryID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing SalesTerritory.TerritoryID.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'CONSTRAINT', N'FK_Customer_SalesTerritory_TerritoryID'
GO
ALTER TABLE [Sales].[Customer]
    WITH CHECK
    ADD CONSTRAINT [FK_Customer_Store_StoreID]
    FOREIGN KEY ([StoreID]) REFERENCES [Sales].[Store] ([BusinessEntityID])
ALTER TABLE [Sales].[Customer]
    CHECK CONSTRAINT [FK_Customer_Store_StoreID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Store.BusinessEntityID.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'CONSTRAINT', N'FK_Customer_Store_StoreID'
GO
CREATE UNIQUE NONCLUSTERED INDEX [AK_Customer_AccountNumber]
    ON [Sales].[Customer] ([AccountNumber])
    ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Unique nonclustered index.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'INDEX', N'AK_Customer_AccountNumber'
GO
CREATE UNIQUE NONCLUSTERED INDEX [AK_Customer_rowguid]
    ON [Sales].[Customer] ([rowguid])
    ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Unique nonclustered index. Used to support replication samples.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'INDEX', N'AK_Customer_rowguid'
GO
CREATE NONCLUSTERED INDEX [IX_Customer_TerritoryID]
    ON [Sales].[Customer] ([TerritoryID])
    ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Nonclustered index.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'INDEX', N'IX_Customer_TerritoryID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Unique number identifying the customer assigned by the accounting system.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'AccountNumber'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'CustomerID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date and time the record was last updated.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'ModifiedDate'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to Person.BusinessEntityID', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'PersonID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'rowguid'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to Store.BusinessEntityID', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'StoreID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', 'COLUMN', N'TerritoryID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Current customer information. Also see the Person and Store tables.', 'SCHEMA', N'Sales', 'TABLE', N'Customer', NULL, NULL
GO

Collapse image See also


List of tables