AdventureWorks
Sales.StoreContact Table
Description
Cross-reference table mapping stores and their employees.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows753
Data Space Used40.00 KB
Index Space Used120.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key CustomerIDStore identification number. Foreign key to Customer.CustomerID.int4   
Primary Key ContactIDContact (store employee) identification number. Foreign key to Contact.ContactID.int4   
 ContactTypeIDContact type such as owner or purchasing agent. Foreign key to ContactType.ContactTypeID.int4   
 rowguidROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.uniqueidentifier16 
(newid())
 
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
AK_StoreContact_rowguidUnique nonclustered index. Used to support replication samples. 
IX_StoreContact_ContactIDNonclustered index.  
IX_StoreContact_ContactTypeIDNonclustered index.  
PK_StoreContact_CustomerID_ContactIDPrimary key (clustered) constraint
Relationships
RelationshipDescription
FK_StoreContact_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_StoreContact_ContactType_ContactTypeIDForeign key constraint referencing ContactType.ContactTypeID.
FK_StoreContact_Store_CustomerIDForeign key constraint referencing Store.CustomerID.
Objects that depend on Sales.StoreContact
 Database ObjectObject TypeDescriptionDep Level
dbo.ufnGetContactInformation functiondbo.ufnGetContactInformationUser Defined FunctionTable value function returning the first name, last name, job title and contact type for a given contact.1
Sales.vStoreWithDemographics viewSales.vStoreWithDemographicsViewStores (names and addresses) that sell Adventure Works Cycles products to consumers.1
Objects that Sales.StoreContact depends on
 Database ObjectObject TypeDescriptionDep Level
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.1
Person.ContactType tablePerson.ContactTypeTableLookup table containing the types of contacts stored in Contact.1
Sales.Customer tableSales.CustomerTableCurrent customer information. Also see the Individual and Store tables.2
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.3
dbo.ErrorLog tabledbo.ErrorLogTableAudit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.3
dbo.Flag datatypedbo.FlagUser Defined Data Type 4
Sales.Individual tableSales.IndividualTableDemographic data about customers that purchase Adventure Works products online.2
dbo.Name datatypedbo.NameUser Defined Data Type 2
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 2
dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
Sales.SalesPerson tableSales.SalesPersonTableSales representative current information.2
Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.3
Sales.Store tableSales.StoreTableCustomers (resellers) of Adventure Works products.1
dbo.ufnLeadingZeros functiondbo.ufnLeadingZerosUser Defined FunctionScalar function used by the Sales.Customer table to help set the account number.3
dbo.uspLogError proceduredbo.uspLogErrorStored ProcedureLogs error information in the ErrorLog table about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without inserting error information.2
dbo.uspPrintError proceduredbo.uspPrintErrorStored ProcedurePrints error information about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without printing any error information.2
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Sales].[StoreContact](
	[CustomerID] [int] NOT NULL,
	[ContactID] [int] NOT NULL,
	[ContactTypeID] [int] NOT NULL,
	[rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_StoreContact_CustomerID_ContactID] PRIMARY KEY CLUSTERED 
(
	[CustomerID] ASC,
	[ContactID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [Sales].[StoreContact]  WITH CHECK ADD  CONSTRAINT [FK_StoreContact_Contact_ContactID] FOREIGN KEY([ContactID])
REFERENCES [Contact] ([ContactID])
ALTER TABLE [Sales].[StoreContact] CHECK CONSTRAINT [FK_StoreContact_Contact_ContactID]
ALTER TABLE [Sales].[StoreContact]  WITH CHECK ADD  CONSTRAINT [FK_StoreContact_ContactType_ContactTypeID] FOREIGN KEY([ContactTypeID])
REFERENCES [ContactType] ([ContactTypeID])
ALTER TABLE [Sales].[StoreContact] CHECK CONSTRAINT [FK_StoreContact_ContactType_ContactTypeID]
ALTER TABLE [Sales].[StoreContact]  WITH CHECK ADD  CONSTRAINT [FK_StoreContact_Store_CustomerID] FOREIGN KEY([CustomerID])
REFERENCES [Store] ([CustomerID])
ALTER TABLE [Sales].[StoreContact] CHECK CONSTRAINT [FK_StoreContact_Store_CustomerID]
ALTER TABLE [Sales].[StoreContact] ADD  CONSTRAINT [DF_StoreContact_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Sales].[StoreContact] ADD  CONSTRAINT [DF_StoreContact_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
See Also

Related Objects

Sales Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.