Difference between revisions of "Sales.Customer (table)"
| (13 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== wikibot == | == wikibot == | ||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- valign="top" | ||
| + | | '''Table | ||
| + | | Sales.Customer | ||
| + | |- valign="top" | ||
| + | | '''Description | ||
| + | | Current customer information. Also see the Individual and Store tables. | ||
| + | |} | ||
| + | |||
| + | === Columns === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Column | ||
| + | | '''Data Type | ||
| + | | '''Nullable | ||
| + | | '''Default | ||
| + | | '''Description | ||
| + | |||
| + | |- valign="top" | ||
| + | | CustomerID | ||
| + | | int | ||
| + | | not null | ||
| + | | | ||
| + | | Primary key for Customer records. | ||
| + | |- valign="top" | ||
| + | | TerritoryID | ||
| + | | int | ||
| + | | null | ||
| + | | | ||
| + | | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. | ||
| + | |- valign="top" | ||
| + | | AccountNumber | ||
| + | | | ||
| + | | | ||
| + | | | ||
| + | | Unique number identifying the customer assigned by the accounting system. | ||
| + | |- valign="top" | ||
| + | | CustomerType | ||
| + | | nchar(1) | ||
| + | | not null | ||
| + | | | ||
| + | | Customer type: I = Individual, S = Store | ||
| + | |- valign="top" | ||
| + | | rowguid | ||
| + | | uniqueidentifier | ||
| + | | not null | ||
| + | | (newid()) | ||
| + | | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. | ||
| + | |- valign="top" | ||
| + | | ModifiedDate | ||
| + | | datetime | ||
| + | | not null | ||
| + | | (getdate()) | ||
| + | | Date and time the record was last updated. | ||
| + | |} | ||
| + | |||
| + | === Primary Key === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Primary Key | ||
| + | | '''Columns | ||
| + | |- valign="top" | ||
| + | | PK_Customer_CustomerID | ||
| + | | CustomerID | ||
| + | |} | ||
| + | |||
| + | === Indexes === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Index | ||
| + | | '''Type | ||
| + | | '''Columns | ||
| + | |||
| + | |- valign="top" | ||
| + | | AK_Customer_AccountNumber | ||
| + | | Unique | ||
| + | | AccountNumber | ||
| + | |- valign="top" | ||
| + | | AK_Customer_rowguid | ||
| + | | Unique | ||
| + | | rowguid | ||
| + | |- valign="top" | ||
| + | | IX_Customer_TerritoryID | ||
| + | | | ||
| + | | TerritoryID | ||
| + | |} | ||
| + | |||
| + | === Check Constraints === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Check Constraint | ||
| + | | '''Expression | ||
| + | | '''Description | ||
| + | |||
| + | |- valign="top" | ||
| + | | CK_Customer_CustomerType | ||
| + | | (upper([CustomerType])='I' OR upper([CustomerType])='S') | ||
| + | | Check constraint [CustomerType]='I' OR [CustomerType]='i' OR [CustomerType]='S' OR [CustomerType]='s' | ||
| + | |} | ||
| + | |||
| + | === Foreign Keys === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Relation | ||
| + | | '''Column | ||
| + | | '''Referenced Column | ||
| + | |||
| + | |- valign="top" | ||
| + | | [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]] | ||
| + | | TerritoryID | ||
| + | | TerritoryID | ||
| + | |} | ||
| + | |||
| + | === Detail Tables === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Detail Table | ||
| + | | '''Column | ||
| + | | '''Referencing Column | ||
| + | |||
| + | |- valign="top" | ||
| + | | [[Sales.CustomerAddress_(table)|Sales.CustomerAddress]] | ||
| + | | CustomerID | ||
| + | | CustomerID | ||
| + | |- valign="top" | ||
| + | | [[Sales.Individual_(table)|Sales.Individual]] | ||
| + | | CustomerID | ||
| + | | CustomerID | ||
| + | |- valign="top" | ||
| + | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
| + | | CustomerID | ||
| + | | CustomerID | ||
| + | |- valign="top" | ||
| + | | [[Sales.Store_(table)|Sales.Store]] | ||
| + | | CustomerID | ||
| + | | CustomerID | ||
| + | |} | ||
| + | |||
| + | === References === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Dependency Type | ||
| + | | '''Object Type | ||
| + | | '''Referenced Object | ||
| + | |||
| + | |- valign="top" | ||
| + | | Schema | ||
| + | | Schema | ||
| + | | [[Sales_(schema)|Sales]] | ||
| + | |||
| + | |} | ||
| + | |||
| + | === Dependencies === | ||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Reference Type | ||
| + | | '''Object Type | ||
| + | | '''Referencing Object | ||
| + | |||
| + | |- valign="top" | ||
| + | | Select | ||
| + | | View | ||
| + | | [[Sales.vIndividualCustomer_(view)|Sales.vIndividualCustomer]] | ||
| + | |||
| + | |- valign="top" | ||
| + | | Select | ||
| + | | View | ||
| + | | [[Sales.vStoreWithDemographics_(view)|Sales.vStoreWithDemographics]] | ||
| + | |||
| + | |} | ||
| + | |||
| + | |||
| + | == automatically generated == | ||
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| Line 5: | Line 179: | ||
| '''Table | | '''Table | ||
| Sales.Customer | | Sales.Customer | ||
| + | |- valign="top" | ||
| + | | '''Description | ||
| + | | Current customer information. Also see the Individual and Store tables. | ||
|- | |- | ||
|} | |} | ||
| Line 15: | Line 192: | ||
| '''Nullable | | '''Nullable | ||
| '''Default | | '''Default | ||
| − | | '''PK | + | | '''Description / PK / Index |
| − | |||
| − | |- | + | |- valign="top" |
| CustomerID | | CustomerID | ||
| int | | int | ||
| not null | | not null | ||
| | | | ||
| − | | PK_Customer_CustomerID | + | | Primary key for Customer records.<br />PK_Customer_CustomerID |
| − | + | |- valign="top" | |
| − | |- | ||
| TerritoryID | | TerritoryID | ||
| int | | int | ||
| null | | null | ||
| | | | ||
| − | | | + | | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.<br />IX_Customer_TerritoryID |
| − | + | |- valign="top" | |
| − | |- | ||
| AccountNumber | | AccountNumber | ||
| | | | ||
| | | | ||
| | | | ||
| − | | | + | | Unique number identifying the customer assigned by the accounting system.<br />AK_Customer_AccountNumber |
| − | + | |- valign="top" | |
| − | |- | ||
| CustomerType | | CustomerType | ||
| nchar(1) | | nchar(1) | ||
| not null | | not null | ||
| | | | ||
| − | | | + | | Customer type: I = Individual, S = Store<br /> |
| − | + | |- valign="top" | |
| − | |- | ||
| rowguid | | rowguid | ||
| uniqueidentifier | | uniqueidentifier | ||
| not null | | not null | ||
| − | | ( | + | | (NEWID()) |
| − | | | + | | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.<br />AK_Customer_rowguid |
| − | + | |- valign="top" | |
| − | |- | ||
| ModifiedDate | | ModifiedDate | ||
| datetime | | datetime | ||
| not null | | not null | ||
| − | | ( | + | | (GETDATE()) |
| − | | | + | | Date and time the record was last updated.<br /> |
| − | |||
|} | |} | ||
| Line 99: | Line 269: | ||
| CustomerID | | CustomerID | ||
| CustomerID | | CustomerID | ||
| + | |} | ||
| + | |||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Dependency Type | ||
| + | | '''Object Type | ||
| + | | '''Referenced Object | ||
| + | |||
| + | |- | ||
| + | | Schema | ||
| + | | Schema | ||
| + | | [[Sales_(schema)|Sales]] | ||
| + | |||
| + | |} | ||
| + | |||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Reference Type | ||
| + | | '''Object Type | ||
| + | | '''Referencing Object | ||
| + | |||
| + | |- | ||
| + | | Select | ||
| + | | View | ||
| + | | [[Sales.vIndividualCustomer_(view)|Sales.vIndividualCustomer]] | ||
| + | |||
| + | |- | ||
| + | | Select | ||
| + | | View | ||
| + | | [[Sales.vStoreWithDemographics_(view)|Sales.vStoreWithDemographics]] | ||
| + | |||
|} | |} | ||
Latest revision as of 09:56, 27 August 2011
Contents
wikibot[edit]
| Table | Sales.Customer |
| Description | Current customer information. Also see the Individual and Store tables. |
Columns[edit]
| Column | Data Type | Nullable | Default | Description |
| CustomerID | int | not null | Primary key for Customer records. | |
| TerritoryID | int | null | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. | |
| AccountNumber | Unique number identifying the customer assigned by the accounting system. | |||
| CustomerType | nchar(1) | not null | Customer type: I = Individual, S = Store | |
| rowguid | uniqueidentifier | not null | (newid()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
| ModifiedDate | datetime | not null | (getdate()) | Date and time the record was last updated. |
Primary Key[edit]
| Primary Key | Columns |
| PK_Customer_CustomerID | CustomerID |
Indexes[edit]
| Index | Type | Columns |
| AK_Customer_AccountNumber | Unique | AccountNumber |
| AK_Customer_rowguid | Unique | rowguid |
| IX_Customer_TerritoryID | TerritoryID |
Check Constraints[edit]
| Check Constraint | Expression | Description |
| CK_Customer_CustomerType | (upper([CustomerType])='I' OR upper([CustomerType])='S') | Check constraint [CustomerType]='I' OR [CustomerType]='i' OR [CustomerType]='S' OR [CustomerType]='s' |
Foreign Keys[edit]
| Relation | Column | Referenced Column |
| Sales.SalesTerritory | TerritoryID | TerritoryID |
Detail Tables[edit]
| Detail Table | Column | Referencing Column |
| Sales.CustomerAddress | CustomerID | CustomerID |
| Sales.Individual | CustomerID | CustomerID |
| Sales.SalesOrderHeader | CustomerID | CustomerID |
| Sales.Store | CustomerID | CustomerID |
References[edit]
| Dependency Type | Object Type | Referenced Object |
| Schema | Schema | Sales |
Dependencies[edit]
| Reference Type | Object Type | Referencing Object |
| Select | View | Sales.vIndividualCustomer |
| Select | View | Sales.vStoreWithDemographics |
automatically generated[edit]
| Table | Sales.Customer |
| Description | Current customer information. Also see the Individual and Store tables. |
| Column | Data Type | Nullable | Default | Description / PK / Index |
| CustomerID | int | not null | Primary key for Customer records. PK_Customer_CustomerID | |
| TerritoryID | int | null | ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. IX_Customer_TerritoryID | |
| AccountNumber | Unique number identifying the customer assigned by the accounting system. AK_Customer_AccountNumber | |||
| CustomerType | nchar(1) | not null | Customer type: I = Individual, S = Store | |
| rowguid | uniqueidentifier | not null | (NEWID()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. AK_Customer_rowguid |
| ModifiedDate | datetime | not null | (GETDATE()) | Date and time the record was last updated. |
| Relation | Column | Referenced Column |
| Sales.SalesTerritory | TerritoryID | TerritoryID |
| Detail Table | Column | Referencing Column |
| Sales.CustomerAddress | CustomerID | CustomerID |
| Sales.Individual | CustomerID | CustomerID |
| Sales.SalesOrderHeader | CustomerID | CustomerID |
| Sales.Store | CustomerID | CustomerID |
| Dependency Type | Object Type | Referenced Object |
| Schema | Schema | Sales |
| Reference Type | Object Type | Referencing Object |
| Select | View | Sales.vIndividualCustomer |
| Select | View | Sales.vStoreWithDemographics |