Northwind Database (Document! X Sample)
AdventureWorks Database / Sales Schema / Sales.Store Table
In This Topic
    Sales.Store Table
    In This Topic
    Description
    Customers (resellers) of Adventure Works products.
    Properties
    Creation Date27/10/2017 14:33
    File GroupPRIMARY
    Text File GroupPRIMARY
    System Object
    Published for Replication
    Rows701
    Data Space Used808.00 KB
    Index Space Used88.00 KB
    Columns
     Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
    Primary Key Primary key. Foreign key to Customer.BusinessEntityID.Integer4   
     Name of the store.dbo.Name50   
     ID of the sales person assigned to the customer. Foreign key to SalesPerson.BusinessEntityID.Integer4  
     Demographic informationg about the store such as the number of employees, annual sales and store type.1410  
     ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.GUID16 
    (newid())
     
     Date and time the record was last updated.DBTimeStamp4 
    (getdate())
     
    Indexes
    IndexDescriptionPrimaryUnique
    Unique nonclustered index. Used to support replication samples. 
    Nonclustered index.  
    Primary key (clustered) constraint
    Primary XML index.  
    Relationships
    RelationshipDescription
    Foreign key constraint referencing BusinessEntity.BusinessEntityID
    Foreign key constraint referencing SalesPerson.SalesPersonID
    Objects that depend on Sales.Store
     Database ObjectObject TypeDescriptionDep Level
    Sales.Customer tableSales.CustomerTableCurrent customer information. Also see the Person and Store tables.2
    iduSalesOrderDetail triggeriduSalesOrderDetailTriggerAFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.3
    Sales.SalesOrderDetail tableSales.SalesOrderDetailTableIndividual products associated with a specific sales order. See SalesOrderHeader.2
    Sales.SalesOrderHeader tableSales.SalesOrderHeaderTableGeneral sales order information.1
    Sales.SalesOrderHeaderSalesReason tableSales.SalesOrderHeaderSalesReasonTableCross-reference table mapping sales orders to sales reason codes.3
    dbo.ufnGetContactInformation functiondbo.ufnGetContactInformationUser Defined FunctionTable value function returning the first name, last name, job title and contact type for a given contact.1
    uSalesOrderHeader triggeruSalesOrderHeaderTriggerAFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.3
    Sales.vIndividualCustomer viewSales.vIndividualCustomerViewIndividual customers (names and addresses) that purchase Adventure Works Cycles products online.2
    Sales.vSalesPersonSalesByFiscalYears viewSales.vSalesPersonSalesByFiscalYearsViewUses PIVOT to return aggregated sales information for each sales representative.3
    Sales.vStoreWithAddresses viewSales.vStoreWithAddressesViewStores (including store addresses) that sell Adventure Works Cycles products to consumers.1
    Sales.vStoreWithContacts viewSales.vStoreWithContactsViewStores (including store contacts) that sell Adventure Works Cycles products to consumers.1
    Sales.vStoreWithDemographics viewSales.vStoreWithDemographicsViewStores (including demographics) that sell Adventure Works Cycles products to consumers.1
    Objects that Sales.Store depends on
     Database ObjectObject TypeDescriptionDep Level
    Person.BusinessEntity tablePerson.BusinessEntityTableSource of the ID that connects vendors, customers, and employees with address and contact information.2
    Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.4
    HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.3
    dbo.Flag datatypedbo.FlagUser Defined Data Type 4
    dbo.Name datatypedbo.NameUser Defined Data Type 2
    dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 5
    Person.Person tablePerson.PersonTableHuman beings involved with AdventureWorks: employees, customer contacts, and vendor contacts.4
    Sales.SalesPerson tableSales.SalesPersonTableSales representative current information.2
    Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.3
    SQL
    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON
    CREATE TABLE [Sales].[Store](
        [BusinessEntityID] [int] NOT NULL,
        [Name] [dbo].[Name] NOT NULL,
        [SalesPersonID] [int] NULL,
        [Demographics] [xml](CONTENT [Sales].[StoreSurveySchemaCollection]) NULL,
        [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
        [ModifiedDate] [datetime] NOT NULL,
     CONSTRAINT [PK_Store_BusinessEntityID] PRIMARY KEY CLUSTERED 
    (
        [BusinessEntityID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    
    ALTER TABLE [Sales].[Store] ADD  CONSTRAINT [DF_Store_rowguid]  DEFAULT (newid()) FOR [rowguid]
    ALTER TABLE [Sales].[Store] ADD  CONSTRAINT [DF_Store_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
    ALTER TABLE [Sales].[Store]  WITH CHECK ADD  CONSTRAINT [FK_Store_BusinessEntity_BusinessEntityID] FOREIGN KEY([BusinessEntityID])
    REFERENCES [Person].[BusinessEntity] ([BusinessEntityID])
    ALTER TABLE [Sales].[Store] CHECK CONSTRAINT [FK_Store_BusinessEntity_BusinessEntityID]
    ALTER TABLE [Sales].[Store]  WITH CHECK ADD  CONSTRAINT [FK_Store_SalesPerson_SalesPersonID] FOREIGN KEY([SalesPersonID])
    REFERENCES [Sales].[SalesPerson] ([BusinessEntityID])
    ALTER TABLE [Sales].[Store] CHECK CONSTRAINT [FK_Store_SalesPerson_SalesPersonID]
    See Also