Database reference - AdventureWorks

AdventureWorks -  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:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count104
Size of data16 kb
Size of indexes32 kb
Maximum size of a single row4,369 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
VendorIDint identity(1,1)104 no  yes    no  Primary key for Vendor records. 
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_VendorIDclustered, unique, primary key located on PRIMARYVendorIDClustered index created by a primary key constraint. 

Referenced by

name
ProductVendor
PurchaseOrderHeader
VendorAddress
VendorContact

Foreign key graph

VendorProductVendorPurchaseOrderHeaderVendorAddressVendorContact

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 typelevel
AccountNumbertype1
Flagtype1
Nametype1

Objects that depend on [Purchasing].[Vendor]

nameobject typelevel
dVendortrigger1
vVendorview1

Sample rows

VendorIDAccountNumberNameCreditRatingPreferredVendorStatusActiveFlagPurchasingWebServiceURLModifiedDate
INTERNAT0001  International  True  True  NULL  2/25/2002 12:00:00 AM 
ELECTRON0002  Electronic Bike Repair & Supplies  True  True  NULL  2/17/2002 12:00:00 AM 
PREMIER0001  Premier Sport, Inc.  True  True  NULL  3/5/2002 12:00:00 AM 
COMFORT0001  Comfort Road Bicycles  True  True  NULL  1/24/2002 12:00:00 AM 
METROSP0001  Metro Sport Equipment  True  True  NULL  3/1/2002 12:00:00 AM 
GREENLA0001  Green Lake Bike Company  True  True  NULL  3/1/2002 12:00:00 AM 
MOUNTAIN0001  Mountain Works  False  True  NULL  3/5/2002 12:00:00 AM 
CONTINEN0001  Continental Pro Cycles  True  True  NULL  1/24/2002 12:00:00 AM 
ADATUM0001  A. Datum Corporation  True  True  www.adatum.com/  1/24/2002 12:00:00 AM 
10  TREYRE0001  Trey Research  True  True  www.treyresearch.net/  2/25/2002 12:00:00 AM 

Code

CREATE TABLE [Purchasing].[Vendor](
    [VendorID] [int] IDENTITY(1,1) NOT NULL,
    [AccountNumber] [dbo].[AccountNumber] NOT NULL,
    [VendorID] [int] IDENTITY(1,1) 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_VendorID] PRIMARY KEY CLUSTERED 
(
    [VendorID] 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 [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]

Powered by Yoyodyne © 1971