Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [Purchasing].[Vendor]

Description

Companies from whom Adventure Works Cycles purchases parts or other goods. 

Table properties

namevalue
name[Purchasing].[Vendor]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count104
Size of data16 kb
Size of indexes32 kb
Maximum size of a single row4,369 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
BusinessEntityIDint104 no  yes  BusinessEntity.BusinessEntityID      no  Primary key for Vendor records. Foreign key to BusinessEntity.BusinessEntityID 
AccountNumberAccountNumber1560 no      no  Vendor account (identification) number. 
NameName50200 no      no  Company name. 
CreditRatingtinyint31 no      no  1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average 
PreferredVendorStatusFlag10((1))no      no  0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product. 
ActiveFlagFlag10((1))no      no  0 = Vendor no longer used. 1 = Vendor is actively used. 
PurchasingWebServiceURLnvarchar(1024)10244096 yes      no  Vendor URL. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
AK_Vendor_AccountNumbernonclustered, unique located on PRIMARYAccountNumberUnique nonclustered index. 
PK_Vendor_BusinessEntityIDclustered, unique, primary key located on PRIMARYBusinessEntityIDClustered index created by a primary key constraint. 

References

name
BusinessEntity

Referenced by

name
ProductVendor
PurchaseOrderHeader

Foreign key graph

BusinessEntityVendorProductVendorPurchaseOrderHeader

Foreign keys

namecolumnsforeign columnstypecomment
FK_Vendor_BusinessEntity_BusinessEntityIDBusinessEntityIDBusinessEntity.BusinessEntityID   Foreign key constraint referencing BusinessEntity.BusinessEntityID 

Check constraints

namecolumncomment
CK_Vendor_CreditRatingCreditRating    Check constraint [CreditRating] BETWEEN (1) AND (5) 

Triggers

namecomment
dVendorINSTEAD OF DELETE trigger which keeps Vendors from being deleted. 

Defaults

default namecolumncomment
DF_Vendor_PreferredVendorStatusPreferredVendorStatusDefault constraint value of 1 (TRUE) 
DF_Vendor_ActiveFlagActiveFlagDefault constraint value of 1 (TRUE) 
DF_Vendor_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

Objects that [Purchasing].[Vendor] depends on

nameobject typedatabaseserverlevel
AccountNumbertypeAdventureWorks2008SPRING\KATMAI1
FlagtypeAdventureWorks2008SPRING\KATMAI1
NametypeAdventureWorks2008SPRING\KATMAI1

Objects that depend on [Purchasing].[Vendor]

nameobject typedatabaseserverlevel
ufnGetContactInformationmulti-statement table valued functionAdventureWorks2008SPRING\KATMAI1
dVendortriggerAdventureWorks2008SPRING\KATMAI1
vVendorWithAddressesviewAdventureWorks2008SPRING\KATMAI1
vVendorWithContactsviewAdventureWorks2008SPRING\KATMAI1

Sample rows

BusinessEntityIDAccountNumberNameCreditRatingPreferredVendorStatusActiveFlagPurchasingWebServiceURLModifiedDate
1492  AUSTRALI0001  Australia Bike Retailer  True  True  NULL  1/23/2002 12:00:00 AM 
1494  ALLENSON0001  Allenson Cycles  True  True  NULL  5/26/2001 12:00:00 AM 
1496  ADVANCED0001  Advanced Bicycles  True  True  NULL  5/26/2001 12:00:00 AM 
1498  TRIKES0001  Trikes, Inc.  True  True  NULL  3/6/2002 12:00:00 AM 
1500  MORGANB0001  Morgan Bike Accessories  True  True  NULL  3/5/2002 12:00:00 AM 
1502  CYCLING0001  Cycling Master  True  True  NULL  1/24/2002 12:00:00 AM 
1504  CHICAGO0002  Chicago Rent-All  True  True  NULL  1/24/2002 12:00:00 AM 
1506  GREENWOO0001  Greenwood Athletic Company  True  True  NULL  2/25/2002 12:00:00 AM 
1508  COMPETE0001  Compete Enterprises, Inc  True  True  NULL  1/24/2002 12:00:00 AM 
1510  INTERNAT0001  International  True  True  NULL  2/25/2002 12:00:00 AM 

Code

CREATE TABLE [Purchasing].[Vendor](
    [BusinessEntityID] [int] NOT NULL,
    [AccountNumber] [dbo].[AccountNumber] NOT NULL,
    [BusinessEntityID] [int] NOT NULL,
    [Name] [dbo].[Name] NOT NULL,
    [CreditRating] [tinyint] NOT NULL,
    [PreferredVendorStatus] [dbo].[Flag] NOT NULL,
    [ActiveFlag] [dbo].[Flag] NOT NULL,
    [PurchasingWebServiceURL] [nvarchar](1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Vendor_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]

ALTER TABLE [Purchasing].[Vendor]  WITH CHECK ADD  CONSTRAINT [FK_Vendor_BusinessEntity_BusinessEntityID] FOREIGN KEY([BusinessEntityID])
REFERENCES [Person].[BusinessEntity] ([BusinessEntityID])
ALTER TABLE [Purchasing].[Vendor] CHECK CONSTRAINT [FK_Vendor_BusinessEntity_BusinessEntityID]
ALTER TABLE [Purchasing].[Vendor]  WITH CHECK ADD  CONSTRAINT [CK_Vendor_CreditRating] CHECK  (([CreditRating]>=(1) AND [CreditRating]<=(5)))
ALTER TABLE [Purchasing].[Vendor] CHECK CONSTRAINT [CK_Vendor_CreditRating]
ALTER TABLE [Purchasing].[Vendor] ADD  CONSTRAINT [DF_Vendor_PreferredVendorStatus]  DEFAULT ((1)) FOR [PreferredVendorStatus]
ALTER TABLE [Purchasing].[Vendor] ADD  CONSTRAINT [DF_Vendor_ActiveFlag]  DEFAULT ((1)) FOR [ActiveFlag]
ALTER TABLE [Purchasing].[Vendor] ADD  CONSTRAINT [DF_Vendor_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]



Documentation generated by SqlSpec