AdventureWorks Database > Purchasing Schema : Purchasing.PurchaseOrderHeader Table |
Creation Date | 08/01/2010 08:40 |
File Group | PRIMARY |
Text File Group | |
System Object | ![]() |
Published for Replication | ![]() |
Rows | 4012 |
Data Space Used | 336.00 KB |
Index Space Used | 144.00 KB |
Column Name | Description | Datatype | Length | Allow Nulls | Default | Formula | |
---|---|---|---|---|---|---|---|
![]() | PurchaseOrderID | Primary key. | int | 4 | |||
RevisionNumber | Incremental number to track changes to the purchase order over time. | tinyint | 1 | ((0)) | |||
Status | Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete | tinyint | 1 | ((1)) | |||
EmployeeID | Employee who created the purchase order. Foreign key to Employee.EmployeeID. | int | 4 | ||||
VendorID | Vendor with whom the purchase order is placed. Foreign key to Vendor.VendorID. | int | 4 | ||||
ShipMethodID | Shipping method. Foreign key to ShipMethod.ShipMethodID. | int | 4 | ||||
OrderDate | Purchase order creation date. | datetime | 4 | (getdate()) | |||
ShipDate | Estimated shipment date from the vendor. | datetime | 4 | ![]() | |||
SubTotal | Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID. | money | 8 | ((0.00)) | |||
TaxAmt | Tax amount. | money | 8 | ((0.00)) | |||
Freight | Shipping cost. | money | 8 | ((0.00)) | |||
TotalDue | Total due to vendor. Computed as Subtotal + TaxAmt + Freight. | money | 8 | (isnull(([SubTotal]+[TaxAmt])+[Freight],(0))) | |||
ModifiedDate | Date and time the record was last updated. | datetime | 4 | (getdate()) |
Index | Description | Primary | Unique |
---|---|---|---|
IX_PurchaseOrderHeader_EmployeeID | Nonclustered index. | ||
IX_PurchaseOrderHeader_VendorID | Nonclustered index. | ||
PK_PurchaseOrderHeader_PurchaseOrderID | Primary key (clustered) constraint | ![]() | ![]() |
Name | Description | Expression |
---|---|---|
CK_PurchaseOrderHeader_Freight | Check constraint [Freight] >= (0.00) | ([Freight]>=(0.00)) |
CK_PurchaseOrderHeader_ShipDate | Check constraint [ShipDate] >= [OrderDate] OR [ShipDate] IS NULL | ([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL) |
CK_PurchaseOrderHeader_Status | Check constraint [Status] BETWEEN (1) AND (4) | ([Status]>=(1) AND [Status]<=(4)) |
CK_PurchaseOrderHeader_SubTotal | Check constraint [SubTotal] >= (0.00) | ([SubTotal]>=(0.00)) |
CK_PurchaseOrderHeader_TaxAmt | Check constraint [TaxAmt] >= (0.00) | ([TaxAmt]>=(0.00)) |
Trigger | Description |
---|---|
uPurchaseOrderHeader | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table. |
Relationship | Description |
---|---|
FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID | Foreign key constraint referencing PurchaseOrderHeader.PurchaseOrderID. |
FK_PurchaseOrderHeader_Employee_EmployeeID | Foreign key constraint referencing Employee.EmployeeID. |
FK_PurchaseOrderHeader_ShipMethod_ShipMethodID | Foreign key constraint referencing ShipMethod.ShipMethodID. |
FK_PurchaseOrderHeader_Vendor_VendorID | Foreign key constraint referencing Vendor.VendorID. |
Database Object | Object Type | Description | Dep Level | |
---|---|---|---|---|
![]() | iPurchaseOrderDetail | Trigger | AFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column. | 2 |
![]() | Purchasing.PurchaseOrderDetail | Table | Individual products associated with a specific purchase order. See PurchaseOrderHeader. | 1 |
![]() | uPurchaseOrderDetail | Trigger | AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column. | 2 |
![]() | uPurchaseOrderHeader | Trigger | AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the PurchaseOrderHeader table. | 1 |
Database Object | Object Type | Description | Dep Level | |
---|---|---|---|---|
![]() | dbo.AccountNumber | User Defined Data Type | 2 | |
![]() | Person.Contact | Table | Names of each employee, customer contact, and vendor contact. | 2 |
![]() | HumanResources.Employee | Table | Employee information such as salary, department, and title. | 1 |
![]() | dbo.ErrorLog | Table | Audit 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. | 2 |
![]() | dbo.Flag | User Defined Data Type | 2 | |
![]() | dbo.NameStyle | User Defined Data Type | 3 | |
![]() | dbo.Phone | User Defined Data Type | 3 | |
![]() | Purchasing.ShipMethod | Table | Shipping company lookup table. | 1 |
![]() | dbo.uspLogError | Stored Procedure | Logs 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. | 1 |
![]() | dbo.uspPrintError | Stored Procedure | Prints 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. | 1 |
![]() | Purchasing.Vendor | Table | Companies from whom Adventure Works Cycles purchases parts or other goods. | 1 |
|