| Owner: | Sales |
| Creation Date: | 04/26/2006 |
| Located On: | PRIMARY |
| Data Size KB: | 808 |
| Index Size KB: | 80 |
| Rows: | 701 |
| Description: | Customers (resellers) of Adventure Works products. |
| Name | Data Type | Length | NULL | Default | IsIdentity | IsGUID | Description | ||
| CustomerID | int | 4 | Primary key. Foreign key to Customer.CustomerID. | ||||||
| Name | Name | 100 | Name of the store. | ||||||
| SalesPersonID | int | 4 | ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID. | ||||||
| Demographics | xml | -1 | Demographic informationg about the store such as the number of employees, annual sales and store type. | ||||||
| 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. |
| Index | Primary | Unique | Description | |
| PK_Store_CustomerID | Primary key (clustered) constraint | |||
| IX_Store_SalesPersonID | Nonclustered index. | |||
| PXML_Store_Demographics | Primary XML index. | |||
| AK_Store_rowguid | Unique nonclustered index. Used to support replication samples. |
| Name | Owner | Instead Of | Disabled | Table/View | Description | |
| iStore | Sales | Sales.Store | AFTER INSERT trigger inserting Store only if the Customer does not exist in the Individual table. |
| Table | Foreign Key | Primary Key or Unique Constraint | |
| Sales.StoreContact | FK_StoreContact_Store_CustomerID | PK_Store_CustomerID |
| Table | Foreign Key | Primary Key or Unique Constraint | |
| Sales.Customer | FK_Store_Customer_CustomerID | PK_Customer_CustomerID | |
| Sales.SalesPerson | FK_Store_SalesPerson_SalesPersonID | PK_SalesPerson_SalesPersonID |
Objects that [Sales].[Store] depends on
| Object Name | Owner | Object Type | Dep Level | |
| Flag | dbo | User Defined type | 1 | |
| Name | dbo | User Defined type | 1 | |
| NameStyle | dbo | User Defined type | 1 | |
| Phone | dbo | User Defined type | 1 | |
| ufnLeadingZeros | dbo | Function | 2 | |
| Contact | Person | Table | 2 | |
| SalesTerritory | Sales | Table | 2 | |
| Customer | Sales | Table | 3 | |
| Employee | HumanResources | Table | 3 | |
| SalesPerson | Sales | Table | 4 |
Objects that depend on [Sales].[Store]
| Object Name | Owner | Object Type | Dep Level | |
| StoreContact | Sales | Table | 1 | |
| iStore | Sales | Trigger | 1 | |
| iuIndividual | Sales | Trigger | 1 | |
| ufnGetContactInformation | dbo | Function | 2 | |
| vStoreWithDemographics | Sales | View | 2 |
CREATE TABLE [Store] (
[CustomerID] [int] NOT NULL ,
[Name] [Name] NOT NULL ,
[SalesPersonID] [int] NULL ,
[Demographics] [xml] NULL ,
[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Store_rowguid] DEFAULT (newid()),
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_Store_ModifiedDate] DEFAULT (getdate()),
CONSTRAINT [PK_Store_CustomerID] PRIMARY KEY CLUSTERED
(
[CustomerID]
) ON [PRIMARY] ,
CONSTRAINT [FK_Store_Customer_CustomerID] FOREIGN KEY
(
[CustomerID]
) REFERENCES [Customer] (
[CustomerID]
),
CONSTRAINT [FK_Store_SalesPerson_SalesPersonID] FOREIGN KEY
(
[SalesPersonID]
) REFERENCES [SalesPerson] (
[SalesPersonID]
)
) ON [PRIMARY]
GO
See Also
List of tables