AdventureWorks
Person.Contact Table
Description
Names of each employee, customer contact, and vendor contact.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File GroupPRIMARY
System Object
Published for Replication
Rows19972
Data Space Used4,536.00 KB
Index Space Used1,896.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key ContactIDPrimary key for Contact records.int4   
 NameStyle0 = The data in FirstName and LastName are stored in western style (first name, last name) order. 1 = Eastern style (last name, first name) order.dbo.NameStyle1 
((0))
 
 TitleA courtesy title. For example, Mr. or Ms.nvarchar8  
 FirstNameFirst name of the person.dbo.Name50   
 MiddleNameMiddle name or middle initial of the person.dbo.Name50  
 LastNameLast name of the person.dbo.Name50   
 SuffixSurname suffix. For example, Sr. or Jr.nvarchar10  
 EmailAddressE-mail address for the person.nvarchar50  
 EmailPromotion0 = Contact does not wish to receive e-mail promotions, 1 = Contact does wish to receive e-mail promotions from AdventureWorks, 2 = Contact does wish to receive e-mail promotions from AdventureWorks and selected partners. int4 
((0))
 
 PhonePhone number associated with the person.dbo.Phone25  
 PasswordHashPassword for the e-mail account.varchar128   
 PasswordSaltRandom value concatenated with the password string before the password is hashed.varchar10   
 AdditionalContactInfoAdditional contact information about the person stored in xml format. Person.AdditionalContactInfoSchemaCollection16  
 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_Contact_rowguidUnique nonclustered index. Used to support replication samples. 
IX_Contact_EmailAddressNonclustered index.  
PK_Contact_ContactIDPrimary key (clustered) constraint
Check Constraints
NameDescriptionExpression
CK_Contact_EmailPromotionCheck constraint [EmailPromotion] >= (0) AND [EmailPromotion] <= (2)
([EmailPromotion]>=(0) AND [EmailPromotion]<=(2))
Relationships
RelationshipDescription
FK_ContactCreditCard_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_Employee_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_Individual_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_SalesOrderHeader_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_StoreContact_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_VendorContact_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
Objects that depend on Person.Contact
 Database ObjectObject TypeDescriptionDep Level
Sales.ContactCreditCard tableSales.ContactCreditCardTableCross-reference table mapping customers in the Contact table to their credit card information in the CreditCard table. 1
dEmployee triggerdEmployeeTriggerINSTEAD OF DELETE trigger which keeps Employees from being deleted.2
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.1
HumanResources.EmployeeAddress tableHumanResources.EmployeeAddressTableCross-reference table mapping employees to their address(es).2
HumanResources.EmployeeDepartmentHistory tableHumanResources.EmployeeDepartmentHistoryTableEmployee department transfers.2
HumanResources.EmployeePayHistory tableHumanResources.EmployeePayHistoryTableEmployee pay history.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.Individual tableSales.IndividualTableDemographic data about customers that purchase Adventure Works products online.1
iPurchaseOrderDetail triggeriPurchaseOrderDetailTriggerAFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.4
iuIndividual triggeriuIndividualTriggerAFTER INSERT, UPDATE trigger inserting Individual only if the Customer does not exist in the Store table and setting the ModifiedDate column in the Individual table to the current date.2
HumanResources.JobCandidate tableHumanResources.JobCandidateTableRésumés submitted to Human Resources by job applicants.2
Purchasing.PurchaseOrderDetail tablePurchasing.PurchaseOrderDetailTableIndividual products associated with a specific purchase order. See PurchaseOrderHeader.3
Purchasing.PurchaseOrderHeader tablePurchasing.PurchaseOrderHeaderTableGeneral purchase order information. See PurchaseOrderDetail.2
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.2
Sales.SalesPerson tableSales.SalesPersonTableSales representative current information.2
Sales.SalesPersonQuotaHistory tableSales.SalesPersonQuotaHistoryTableSales performance tracking.3
Sales.SalesTerritoryHistory tableSales.SalesTerritoryHistoryTableSales representative transfers to other sales territories.3
Sales.StoreContact tableSales.StoreContactTableCross-reference table mapping stores and their employees.1
dbo.ufnGetContactInformation functiondbo.ufnGetContactInformationUser Defined FunctionTable value function returning the first name, last name, job title and contact type for a given contact.1
uPurchaseOrderDetail triggeruPurchaseOrderDetailTriggerAFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.4
uPurchaseOrderHeader triggeruPurchaseOrderHeaderTriggerAFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table.3
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.2
dbo.uspGetEmployeeManagers proceduredbo.uspGetEmployeeManagersStored ProcedureStored procedure using a recursive query to return the direct and indirect managers of the specified employee.1
dbo.uspGetManagerEmployees proceduredbo.uspGetManagerEmployeesStored ProcedureStored procedure using a recursive query to return the direct and indirect employees of the specified manager.1
HumanResources.uspUpdateEmployeeHireInfo procedureHumanResources.uspUpdateEmployeeHireInfoStored ProcedureUpdates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.2
HumanResources.uspUpdateEmployeeLogin procedureHumanResources.uspUpdateEmployeeLoginStored ProcedureUpdates the Employee table with the values specified in the input parameters for the given EmployeeID.2
HumanResources.uspUpdateEmployeePersonalInfo procedureHumanResources.uspUpdateEmployeePersonalInfoStored ProcedureUpdates the Employee table with the values specified in the input parameters for the given EmployeeID.2
Person.vAdditionalContactInfo viewPerson.vAdditionalContactInfoViewDisplays the contact name and content from each element in the xml column AdditionalContactInfo for that person.1
HumanResources.vEmployee viewHumanResources.vEmployeeViewEmployee names and addresses.1
HumanResources.vEmployeeDepartment viewHumanResources.vEmployeeDepartmentViewReturns employee name, title, and current department.1
HumanResources.vEmployeeDepartmentHistory viewHumanResources.vEmployeeDepartmentHistoryViewReturns employee name and current and previous departments.1
Purchasing.VendorContact tablePurchasing.VendorContactTableCross-reference table mapping vendors and their employees.1
Sales.vIndividualCustomer viewSales.vIndividualCustomerViewIndividual customers (names and addresses) that purchase Adventure Works Cycles products online.1
Sales.vIndividualDemographics viewSales.vIndividualDemographicsViewDisplays the content from each element in the xml column Demographics for each customer in the Sales.Individual table.2
HumanResources.vJobCandidate viewHumanResources.vJobCandidateViewJob candidate names and resumes.3
HumanResources.vJobCandidateEducation viewHumanResources.vJobCandidateEducationViewDisplays the content from each education related element in the xml column Resume in the HumanResources.JobCandidate table. The content has been localized into French, Simplified Chinese and Thai. Some data may not display correctly unless supplemental language support is installed.3
HumanResources.vJobCandidateEmployment viewHumanResources.vJobCandidateEmploymentViewDisplays the content from each employement history related element in the xml column Resume in the HumanResources.JobCandidate table. The content has been localized into French, Simplified Chinese and Thai. Some data may not display correctly unless supplemental language support is installed.3
Sales.vSalesPerson viewSales.vSalesPersonViewSales representiatives (names and addresses) and their sales-related information.1
Sales.vSalesPersonSalesByFiscalYears viewSales.vSalesPersonSalesByFiscalYearsViewUses PIVOT to return aggregated sales information for each sales representative.1
Sales.vStoreWithDemographics viewSales.vStoreWithDemographicsViewStores (names and addresses) that sell Adventure Works Cycles products to consumers.1
Purchasing.vVendor viewPurchasing.vVendorViewVendor (company) names and addresses and the names of vendor employees to contact.1
Objects that Person.Contact depends on
 Database ObjectObject TypeDescriptionDep Level
dbo.Name datatypedbo.NameUser Defined Data Type 1
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 1
dbo.Phone datatypedbo.PhoneUser Defined Data Type 1
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Person].[Contact](
	[ContactID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[NameStyle] [dbo].[NameStyle] NOT NULL,
	[Title] [nvarchar](8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[FirstName] [dbo].[Name] NOT NULL,
	[MiddleName] [dbo].[Name] NULL,
	[LastName] [dbo].[Name] NOT NULL,
	[Suffix] [nvarchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[EmailAddress] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[EmailPromotion] [int] NOT NULL,
	[Phone] [dbo].[Phone] NULL,
	[PasswordHash] [varchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[PasswordSalt] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[AdditionalContactInfo] [xml](CONTENT [Person].[AdditionalContactInfoSchemaCollection]) NULL,
	[rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Contact_ContactID] PRIMARY KEY CLUSTERED 
(
	[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 [Person].[Contact]  WITH CHECK ADD  CONSTRAINT [CK_Contact_EmailPromotion] CHECK  (([EmailPromotion]>=(0) AND [EmailPromotion]<=(2)))
ALTER TABLE [Person].[Contact] CHECK CONSTRAINT [CK_Contact_EmailPromotion]
ALTER TABLE [Person].[Contact] ADD  CONSTRAINT [DF_Contact_NameStyle]  DEFAULT ((0)) FOR [NameStyle]
ALTER TABLE [Person].[Contact] ADD  CONSTRAINT [DF_Contact_EmailPromotion]  DEFAULT ((0)) FOR [EmailPromotion]
ALTER TABLE [Person].[Contact] ADD  CONSTRAINT [DF_Contact_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Person].[Contact] ADD  CONSTRAINT [DF_Contact_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
See Also

Related Objects

Person Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.