# Table: PurchaseOrderHeader

## Properties

Property | Value
--- | ---
Name | PurchaseOrderHeader
ID | 690101499
Owner | dbo
Schema | Purchasing
Filegroup | PRIMARY
Data Size (KB) | 336 KB
Index Size (KB) | 144 KB
Rows | 4012
Unused (KB) | 48 KB
ANSI Null On |
Quoted Identifier |
Lock Escalation | TABLE
Lock On Bulk Load |
Lob Data Space |
Filestream Data Space ID |
Has Unchecked Assembly Data |
Text In Row Limit (bytes) | Option not set
Large Value Types Out Of Row |
FullText Change Tracking On |
Tracked By Cdc |
Published |
Schema Published |
Replicated |
Replication Filter |
Merge Published |
Sync Tran Subscribed |
MS Shipped |
Modify Date | 8/8/2010 5:23:44 PM
Create Date | 8/8/2010 5:21:52 PM

## Extended Properties

Name | Value
--- | ---
MS_Description | General purchase order information. See PurchaseOrderDetail.

## Columns

Column ID | Column Name | Datatype | Nullable | Is Sparse | Is Column Set
--- | --- | --- | --- | --- | ---
1 | PurchaseOrderID | int |  |  |
2 | RevisionNumber | tinyint |  |  |
3 | Status | tinyint |  |  |
4 | EmployeeID | int |  |  |
5 | VendorID | int |  |  |
6 | ShipMethodID | int |  |  |
7 | OrderDate | datetime |  |  |
8 | ShipDate | datetime |  |  |
9 | SubTotal | money |  |  |
10 | TaxAmt | money |  |  |
11 | Freight | money |  |  |
12 | TotalDue | money |  |  |
13 | ModifiedDate | datetime |  |  |

## Identity Columns

Column | Seed Value | Increment Value | Last Value | Is Not For Replication | Is Computed | Is Sparse | Is Column Set
--- | --- | --- | --- | --- | --- | --- | ---
PurchaseOrderID | 1 | 1 | 4012 |  |  |  |

## Primary Key Constraints

Name | Is System Named | Extended Property Name | Extended Property Value
--- | --- | --- | ---
PK_PurchaseOrderHeader_PurchaseOrderID |  | MS_Description | Primary key (clustered) constraint

## Primary Key Columns

Name
PurchaseOrderID

## Foreign Keys

Name | Referenced Object | Update Action | Delete Action
--- | --- | --- | ---
FK_PurchaseOrderHeader_Employee_EmployeeID | HumanResources.Employee | No action | No action
FK_PurchaseOrderHeader_Vendor_VendorID | Purchasing.Vendor | No action | No action
FK_PurchaseOrderHeader_ShipMethod_ShipMethodID | Purchasing.ShipMethod | No action | No action

## Column Level Check Constraints

Name | Column ID | Column | Definition | Is Disabled | Is Not For Replication | Is Not Trusted | Uses Database Collation | Is System Named
--- | --- | --- | --- | --- | --- | --- | --- | ---
CK_PurchaseOrderHeader_Status | 3 | Status | ([Status]>=(1) AND [Status]<=(4)) |  |  |  |  |
CK_PurchaseOrderHeader_SubTotal | 9 | SubTotal | ([SubTotal]>=(0.00)) |  |  |  |  |
CK_PurchaseOrderHeader_TaxAmt | 10 | TaxAmt | ([TaxAmt]>=(0.00)) |  |  |  |  |
CK_PurchaseOrderHeader_Freight | 11 | Freight | ([Freight]>=(0.00)) |  |  |  |  |

## Table Level Check Constraints

Name | Definition | Is Disabled | Is Not For Replication | Is Not Trusted | Uses Database Collation | Is System Named
--- | --- | --- | --- | --- | --- | ---
CK_PurchaseOrderHeader_ShipDate | ([ShipDate]>=[OrderDate] OR [ShipDate] IS NULL) |  |  |  |  |

## Default Constraints

Name | Column | Definition | Is System Named | Extended Property Name | Extended Property Value
--- | --- | --- | --- | --- | ---
DF_PurchaseOrderHeader_RevisionNumber | RevisionNumber | ((0)) |  | MS_Description | Default constraint value of 0
DF_PurchaseOrderHeader_Status | Status | ((1)) |  | MS_Description | Default constraint value of 1
DF_PurchaseOrderHeader_OrderDate | OrderDate | (getdate()) |  | MS_Description | Default constraint value of GETDATE()
DF_PurchaseOrderHeader_SubTotal | SubTotal | ((0.00)) |  | MS_Description | Default constraint value of 0.0
DF_PurchaseOrderHeader_TaxAmt | TaxAmt | ((0.00)) |  | MS_Description | Default constraint value of 0.0
DF_PurchaseOrderHeader_Freight | Freight | ((0.00)) |  | MS_Description | Default constraint value of 0.0
DF_PurchaseOrderHeader_ModifiedDate | ModifiedDate | (getdate()) |  | MS_Description | Default constraint value of GETDATE()

## Indexes

Name | Index Type | Primary Key | Unique | Unique Constraint | Ignore Duplicate Key | Disabled
--- | --- | --- | --- | --- | --- | ---
PK_PurchaseOrderHeader_PurchaseOrderID | CLUSTERED |  |  |  |  |
IX_PurchaseOrderHeader_VendorID | NONCLUSTERED |  |  |  |  |
IX_PurchaseOrderHeader_EmployeeID | NONCLUSTERED |  |  |  |  |

## FullText Indexes

No fulltext indexes defined.

## Referencing Tables

Name | Key Index ID | Is Disabled | Is Not For Replication | Is Not Trusted | Delete Action | Update Action | Is System Named | Referencing Object
--- | --- | --- | --- | --- | --- | --- | --- | ---
FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID | 1 |  |  |  | No action | No action |  | Purchasing.PurchaseOrderDetail

## Object Level Permissions

No object level permissions defined.

## Column Level Permissions

No explicit column permissions granted to this object

## Statistics

### Detailed Statistics General

Name | Updated | Rows | Rows Sampled | Steps | Density | Average Key Length | String Index | Filter Expression | Unfiltered Rows
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
PK_PurchaseOrderHeader_PurchaseOrderID | Aug 8 2010 5:22PM | 4012 | 4012 | 44 | 1 | 4 |  |  | 4012

### Detailed Statistics Density

All Density | Average Length | Columns
--- | --- | ---
0.0002492522 | 4 | PurchaseOrderID

### Detailed Statistics Histogram

Range High Key | Range Rows | Estimated Rows | Distinct Range Rows | Avg Range Rows
--- | --- | --- | --- | ---
1 | 0 | 1 | 0 | 1
87 | 85 | 1 | 85 | 1
146 | 58 | 1 | 58 | 1
248 | 101 | 1 | 101 | 1
336 | 87 | 1 | 87 | 1
400 | 63 | 1 | 63 | 1
472 | 71 | 1 | 71 | 1
584 | 111 | 1 | 111 | 1
688 | 103 | 1 | 103 | 1
760 | 71 | 1 | 71 | 1
824 | 63 | 1 | 63 | 1
888 | 63 | 1 | 63 | 1
968 | 79 | 1 | 79 | 1
1040 | 71 | 1 | 71 | 1
1112 | 71 | 1 | 71 | 1
1176 | 63 | 1 | 63 | 1
1248 | 71 | 1 | 71 | 1
1312 | 63 | 1 | 63 | 1
1400 | 87 | 1 | 87 | 1
1464 | 63 | 1 | 63 | 1
1584 | 119 | 1 | 119 | 1
1696 | 111 | 1 | 111 | 1
1760 | 63 | 1 | 63 | 1
1856 | 95 | 1 | 95 | 1
1920 | 63 | 1 | 63 | 1
1984 | 63 | 1 | 63 | 1
2048 | 63 | 1 | 63 | 1
2112 | 63 | 1 | 63 | 1
2176 | 63 | 1 | 63 | 1
2240 | 63 | 1 | 63 | 1
2304 | 63 | 1 | 63 | 1
2368 | 63 | 1 | 63 | 1
2432 | 63 | 1 | 63 | 1
2496 | 63 | 1 | 63 | 1
2560 | 63 | 1 | 63 | 1
2624 | 63 | 1 | 63 | 1
2688 | 63 | 1 | 63 | 1
2752 | 63 | 1 | 63 | 1
2816 | 63 | 1 | 63 | 1
2896 | 79 | 1 | 79 | 1
2960 | 63 | 1 | 63 | 1
4008 | 1047 | 1 | 1047 | 1
4011 | 2 | 1 | 2 | 1
4012 | 0 | 1 | 0 | 1

### Detailed Statistics General

Name | Updated | Rows | Rows Sampled | Steps | Density | Average Key Length | String Index | Filter Expression | Unfiltered Rows
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
IX_PurchaseOrderHeader_VendorID | Aug 8 2010 5:23PM | 4012 | 4012 | 59 | 0.02047005 | 8 |  |  | 4012

### Detailed Statistics Density

All Density | Average Length | Columns
--- | --- | ---
0.01162791 | 4 | VendorID
0.0002492522 | 8 | VendorID, PurchaseOrderID

### Detailed Statistics Histogram

Range High Key | Range Rows | Estimated Rows | Distinct Range Rows | Avg Range Rows
--- | --- | --- | --- | ---
1492 | 0 | 51 | 0 | 1
1496 | 51 | 51 | 1 | 51
1500 | 50 | 50 | 1 | 50
1504 | 0 | 51 | 0 | 1
1508 | 51 | 51 | 1 | 51
1510 | 0 | 51 | 0 | 1
1514 | 0 | 50 | 0 | 1
1516 | 0 | 51 | 0 | 1
1520 | 1 | 1 | 1 | 1
1522 | 0 | 51 | 0 | 1
1530 | 51 | 51 | 1 | 51
1534 | 0 | 50 | 0 | 1
1538 | 51 | 50 | 1 | 51
1542 | 51 | 51 | 1 | 51
1544 | 0 | 51 | 0 | 1
1546 | 0 | 2 | 0 | 1
1548 | 0 | 51 | 0 | 1
1554 | 0 | 50 | 0 | 1
1556 | 0 | 50 | 0 | 1
1560 | 0 | 51 | 0 | 1
1562 | 0 | 50 | 0 | 1
1566 | 0 | 51 | 0 | 1
1570 | 51 | 51 | 1 | 51
1572 | 0 | 50 | 0 | 1
1574 | 0 | 2 | 0 | 1
1578 | 50 | 50 | 1 | 50
1582 | 51 | 51 | 1 | 51
1586 | 51 | 50 | 1 | 51
1590 | 50 | 50 | 1 | 50
1592 | 0 | 50 | 0 | 1
1594 | 0 | 1 | 0 | 1
1598 | 0 | 51 | 0 | 1
1602 | 51 | 51 | 1 | 51
1604 | 0 | 51 | 0 | 1
1608 | 0 | 50 | 0 | 1
1612 | 51 | 50 | 1 | 51
1616 | 50 | 51 | 1 | 50
1620 | 50 | 51 | 1 | 50
1624 | 50 | 51 | 1 | 50
1628 | 51 | 51 | 1 | 51
1632 | 0 | 50 | 0 | 1
1636 | 0 | 4 | 0 | 1
1638 | 0 | 51 | 0 | 1
1644 | 0 | 51 | 0 | 1
1648 | 51 | 51 | 1 | 51
1652 | 51 | 50 | 1 | 51
1656 | 51 | 50 | 1 | 51
1658 | 0 | 51 | 0 | 1
1662 | 0 | 50 | 0 | 1
1666 | 51 | 51 | 1 | 51
1672 | 0 | 51 | 0 | 1
1674 | 0 | 50 | 0 | 1
1676 | 0 | 1 | 0 | 1
1680 | 51 | 51 | 1 | 51
1684 | 50 | 50 | 1 | 50
1688 | 50 | 50 | 1 | 50
1692 | 51 | 51 | 1 | 51
1696 | 51 | 51 | 1 | 51
1698 | 0 | 51 | 0 | 1

### Detailed Statistics General

Name | Updated | Rows | Rows Sampled | Steps | Density | Average Key Length | String Index | Filter Expression | Unfiltered Rows
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
IX_PurchaseOrderHeader_EmployeeID | Aug 8 2010 5:23PM | 4012 | 4012 | 12 | 0 | 8 |  |  | 4012

### Detailed Statistics Density

All Density | Average Length | Columns
--- | --- | ---
0.08333334 | 4 | EmployeeID
0.0002492522 | 8 | EmployeeID, PurchaseOrderID

### Detailed Statistics Histogram

Range High Key | Range Rows | Estimated Rows | Distinct Range Rows | Avg Range Rows
--- | --- | --- | --- | ---
250 | 0 | 160 | 0 | 1
251 | 0 | 361 | 0 | 1
252 | 0 | 164 | 0 | 1
253 | 0 | 400 | 0 | 1
254 | 0 | 362 | 0 | 1
255 | 0 | 360 | 0 | 1
256 | 0 | 361 | 0 | 1
257 | 0 | 360 | 0 | 1
258 | 0 | 361 | 0 | 1
259 | 0 | 360 | 0 | 1
260 | 0 | 362 | 0 | 1
261 | 0 | 401 | 0 | 1

### Detailed Statistics General

Name | Updated | Rows | Rows Sampled | Steps | Density | Average Key Length | String Index | Filter Expression | Unfiltered Rows
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
_WA_Sys_00000006_29221CFB | Aug 8 2010 5:23PM | 4012 | 4012 | 5 | 0 | 4 |  |  | 4012

### Detailed Statistics Density

All Density | Average Length | Columns
--- | --- | ---
0.2 | 4 | ShipMethodID

### Detailed Statistics Histogram

Range High Key | Range Rows | Estimated Rows | Distinct Range Rows | Avg Range Rows
--- | --- | --- | --- | ---
1 | 0 | 589 | 0 | 1
2 | 0 | 655 | 0 | 1
3 | 0 | 160 | 0 | 1
4 | 0 | 1085 | 0 | 1
5 | 0 | 1523 | 0 | 1

## Objects that depend on [PurchaseOrderHeader]

- Purchasing.PurchaseOrderHeader
  - Purchasing.PurchaseOrderDetail
    - Purchasing.iPurchaseOrderDetail
    - Purchasing.uPurchaseOrderDetail
  - Purchasing.uPurchaseOrderHeader

## Objects on which [PurchaseOrderHeader] depends

- Purchasing.PurchaseOrderHeader
  - HumanResources.Employee
    - Person.Person
      - Demographics.exist
      - Person.IndividualSurveySchemaCollection
      - dbo.Name
      - dbo.NameStyle
      - Person.AdditionalContactInfoSchemaCollection
      - Person.BusinessEntity
    - dbo.Flag
  - Purchasing.Vendor
    - dbo.uspLogError
      - dbo.uspPrintError
      - dbo.ErrorLog
    - dbo.AccountNumber
  - Purchasing.ShipMethod

## SQL

Script
SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE TABLE [Purchasing].[PurchaseOrderHeader]( [PurchaseOrderID] [int] IDENTITY(1,1) NOT NULL, [RevisionNumber] [tinyint] NOT NULL, [Status] [tinyint] NOT NULL, [EmployeeID] [int] NOT NULL, [VendorID] [int] NOT NULL, [ShipMethodID] [int] NOT NULL, [OrderDate] [datetime] NOT NULL, [ShipDate] [datetime] NULL, [SubTotal] [money] NOT NULL, [TaxAmt] [money] NOT NULL, [Freight] [money] NOT NULL, [TotalDue] AS (isnull(([SubTotal]+[TaxAmt])+[Freight],(0))) PERSISTED NOT NULL, [ModifiedDate] [datetime] NOT NULL ) ON [PRIMARY] EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Primary key.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'PurchaseOrderID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Incremental number to track changes to the purchase order over time.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'RevisionNumber' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'Status' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Employee who created the purchase order. Foreign key to Employee.BusinessEntityID.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'EmployeeID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Vendor with whom the purchase order is placed. Foreign key to Vendor.BusinessEntityID.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'VendorID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Shipping method. Foreign key to ShipMethod.ShipMethodID.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'ShipMethodID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Purchase order creation date.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'OrderDate' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Estimated shipment date from the vendor.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'ShipDate' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'SubTotal' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Tax amount.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'TaxAmt' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Shipping cost.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'Freight' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Total due to vendor. Computed as Subtotal + TaxAmt + Freight.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'TotalDue' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Date and time the record was last updated.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader', @level2type=N'COLUMN',@level2name=N'ModifiedDate' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'General purchase order information. See PurchaseOrderDetail.' , @level0type=N'SCHEMA',@level0name=N'Purchasing', @level1type=N'TABLE',@level1name=N'PurchaseOrderHeader'

#### See also

List of Tables