AdventureWorks
Purchasing.VendorContact Table
Description
Cross-reference table mapping vendors and their employees.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows156
Data Space Used8.00 KB
Index Space Used40.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key VendorIDPrimary key.int4   
Primary Key ContactIDContact (Vendor employee) identification number. Foreign key to Contact.ContactID.int4   
 ContactTypeIDContact type such as sales manager, or sales agent.int4   
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
IX_VendorContact_ContactIDNonclustered index.  
IX_VendorContact_ContactTypeIDNonclustered index.  
PK_VendorContact_VendorID_ContactIDPrimary key (clustered) constraint
Relationships
RelationshipDescription
FK_VendorContact_Contact_ContactIDForeign key constraint referencing Contact.ContactID.
FK_VendorContact_ContactType_ContactTypeIDForeign key constraint referencing ContactType.ContactTypeID.
FK_VendorContact_Vendor_VendorIDForeign key constraint referencing Vendor.VendorID.
Objects that depend on Purchasing.VendorContact
 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
Purchasing.vVendor viewPurchasing.vVendorViewVendor (company) names and addresses and the names of vendor employees to contact.1
Objects that Purchasing.VendorContact depends on
 Database ObjectObject TypeDescriptionDep Level
dbo.AccountNumber datatypedbo.AccountNumberUser Defined Data Type 2
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
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 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
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
Purchasing.Vendor tablePurchasing.VendorTableCompanies from whom Adventure Works Cycles purchases parts or other goods.1
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Purchasing].[VendorContact](
	[VendorID] [int] NOT NULL,
	[ContactID] [int] NOT NULL,
	[ContactTypeID] [int] NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_VendorContact_VendorID_ContactID] PRIMARY KEY CLUSTERED 
(
	[VendorID] 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 [Purchasing].[VendorContact]  WITH CHECK ADD  CONSTRAINT [FK_VendorContact_Contact_ContactID] FOREIGN KEY([ContactID])
REFERENCES [Contact] ([ContactID])
ALTER TABLE [Purchasing].[VendorContact] CHECK CONSTRAINT [FK_VendorContact_Contact_ContactID]
ALTER TABLE [Purchasing].[VendorContact]  WITH CHECK ADD  CONSTRAINT [FK_VendorContact_ContactType_ContactTypeID] FOREIGN KEY([ContactTypeID])
REFERENCES [ContactType] ([ContactTypeID])
ALTER TABLE [Purchasing].[VendorContact] CHECK CONSTRAINT [FK_VendorContact_ContactType_ContactTypeID]
ALTER TABLE [Purchasing].[VendorContact]  WITH CHECK ADD  CONSTRAINT [FK_VendorContact_Vendor_VendorID] FOREIGN KEY([VendorID])
REFERENCES [Vendor] ([VendorID])
ALTER TABLE [Purchasing].[VendorContact] CHECK CONSTRAINT [FK_VendorContact_Vendor_VendorID]
ALTER TABLE [Purchasing].[VendorContact] ADD  CONSTRAINT [DF_VendorContact_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
See Also

Related Objects

Purchasing Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.