Difference between revisions of "Sales.SalesOrderHeader (table)"

From dbscript Online Help
Jump to: navigation, search
Line 5: Line 5:
 
| '''Table
 
| '''Table
 
| Sales.SalesOrderHeader
 
| Sales.SalesOrderHeader
 +
|- valign="top"
 +
| '''Description
 +
| General sales order information.
 
|-
 
|-
 
|}
 
|}
Line 15: Line 18:
 
| '''Nullable
 
| '''Nullable
 
| '''Default
 
| '''Default
| '''PK
+
| '''Description / PK / Index
| '''Index
 
 
 
|-
+
|- valign="top"
 
| SalesOrderID
 
| SalesOrderID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
| PK_SalesOrderHeader_SalesOrderID
+
| Primary key.<br />PK_SalesOrderHeader_SalesOrderID
|
+
|- valign="top"
|-
 
 
| RevisionNumber
 
| RevisionNumber
 
| tinyint
 
| tinyint
 
| not null
 
| not null
 
| ((0))
 
| ((0))
|  
+
| Incremental number to track changes to the sales order over time.<br />
|
+
|- valign="top"
|-
 
 
| OrderDate
 
| OrderDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
| (getdate())
 
| (getdate())
|  
+
| Dates the sales order was created.<br />
|
+
|- valign="top"
|-
 
 
| DueDate
 
| DueDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
|  
 
|  
|  
+
| Date the order is due to the customer.<br />
|
+
|- valign="top"
|-
 
 
| ShipDate
 
| ShipDate
 
| datetime
 
| datetime
 
| null
 
| null
 
|  
 
|  
|  
+
| Date the order was shipped to the customer.<br />
|
+
|- valign="top"
|-
 
 
| Status
 
| Status
 
| tinyint
 
| tinyint
 
| not null
 
| not null
 
| ((1))
 
| ((1))
|  
+
| Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled<br />
|
+
|- valign="top"
|-
 
 
| OnlineOrderFlag
 
| OnlineOrderFlag
 
| dbo.Flag
 
| dbo.Flag
 
| not null
 
| not null
 
| ((1))
 
| ((1))
|  
+
| 0 = Order placed by sales person. 1 = Order placed online by customer.<br />
|
+
|- valign="top"
|-
 
 
| SalesOrderNumber
 
| SalesOrderNumber
 
|  
 
|  
 
|  
 
|  
 
|  
 
|  
|  
+
| Unique sales order identification number.<br />AK_SalesOrderHeader_SalesOrderNumber
| AK_SalesOrderHeader_SalesOrderNumber
+
|- valign="top"
|-
 
 
| PurchaseOrderNumber
 
| PurchaseOrderNumber
 
| dbo.OrderNumber
 
| dbo.OrderNumber
 
| null
 
| null
 
|  
 
|  
|  
+
| Customer purchase order number reference. <br />
|
+
|- valign="top"
|-
 
 
| AccountNumber
 
| AccountNumber
 
| dbo.AccountNumber
 
| dbo.AccountNumber
 
| null
 
| null
 
|  
 
|  
|  
+
| Financial accounting number reference.<br />
|
+
|- valign="top"
|-
 
 
| CustomerID
 
| CustomerID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
|  
+
| Customer identification number. Foreign key to Customer.CustomerID.<br />IX_SalesOrderHeader_CustomerID
| IX_SalesOrderHeader_CustomerID
+
|- valign="top"
|-
 
 
| ContactID
 
| ContactID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
|  
+
| Customer contact identification number. Foreign key to Contact.ContactID.<br />
|
+
|- valign="top"
|-
 
 
| SalesPersonID
 
| SalesPersonID
 
| int
 
| int
 
| null
 
| null
 
|  
 
|  
|  
+
| Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.<br />IX_SalesOrderHeader_SalesPersonID
| IX_SalesOrderHeader_SalesPersonID
+
|- valign="top"
|-
 
 
| TerritoryID
 
| TerritoryID
 
| int
 
| int
 
| null
 
| null
 
|  
 
|  
|  
+
| Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.<br />
|
+
|- valign="top"
|-
 
 
| BillToAddressID
 
| BillToAddressID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
|  
+
| Customer billing address. Foreign key to Address.AddressID.<br />
|
+
|- valign="top"
|-
 
 
| ShipToAddressID
 
| ShipToAddressID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
|  
+
| Customer shipping address. Foreign key to Address.AddressID.<br />
|
+
|- valign="top"
|-
 
 
| ShipMethodID
 
| ShipMethodID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
|  
+
| Shipping method. Foreign key to ShipMethod.ShipMethodID.<br />
|
+
|- valign="top"
|-
 
 
| CreditCardID
 
| CreditCardID
 
| int
 
| int
 
| null
 
| null
 
|  
 
|  
|  
+
| Credit card identification number. Foreign key to CreditCard.CreditCardID.<br />
|
+
|- valign="top"
|-
 
 
| CreditCardApprovalCode
 
| CreditCardApprovalCode
 
| varchar(15)
 
| varchar(15)
 
| null
 
| null
 
|  
 
|  
|  
+
| Approval code provided by the credit card company.<br />
|
+
|- valign="top"
|-
 
 
| CurrencyRateID
 
| CurrencyRateID
 
| int
 
| int
 
| null
 
| null
 
|  
 
|  
|  
+
| Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.<br />
|
+
|- valign="top"
|-
 
 
| SubTotal
 
| SubTotal
 
| money
 
| money
 
| not null
 
| not null
 
| ((0.00))
 
| ((0.00))
|  
+
| Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.<br />
|
+
|- valign="top"
|-
 
 
| TaxAmt
 
| TaxAmt
 
| money
 
| money
 
| not null
 
| not null
 
| ((0.00))
 
| ((0.00))
|  
+
| Tax amount.<br />
|
+
|- valign="top"
|-
 
 
| Freight
 
| Freight
 
| money
 
| money
 
| not null
 
| not null
 
| ((0.00))
 
| ((0.00))
|  
+
| Shipping cost.<br />
|
+
|- valign="top"
|-
 
 
| TotalDue
 
| TotalDue
 
|  
 
|  
 
|  
 
|  
 
|  
 
|  
|  
+
| Total due from customer. Computed as Subtotal + TaxAmt + Freight.<br />
|
+
|- valign="top"
|-
 
 
| Comment
 
| Comment
 
| nvarchar(128)
 
| nvarchar(128)
 
| null
 
| null
 
|  
 
|  
|  
+
| Sales representative comments.<br />
|
+
|- valign="top"
|-
 
 
| rowguid
 
| rowguid
 
| uniqueidentifier
 
| uniqueidentifier
 
| not null
 
| not null
 
| (newid())
 
| (newid())
|  
+
| ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.<br />AK_SalesOrderHeader_rowguid
| AK_SalesOrderHeader_rowguid
+
|- valign="top"
|-
 
 
| ModifiedDate
 
| ModifiedDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
| (getdate())
 
| (getdate())
|  
+
| Date and time the record was last updated.<br />
|
 
 
|}
 
|}
  
Line 282: Line 257:
 
| ON UPDATE
 
| ON UPDATE
 
|}
 
|}
 +
 +
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Dependency Type
 +
| '''Object Type
 +
| '''Referenced Object
 +
 +
| '''Child Type
 +
| '''Child Object
 +
 +
|-
 +
| Data Type
 +
| Type
 +
| [[dbo.AccountNumber_(type)|dbo.AccountNumber]]
 +
 +
|
 +
|
 +
|-
 +
| Data Type
 +
| Type
 +
| [[dbo.Flag_(type)|dbo.Flag]]
 +
 +
|
 +
|
 +
|-
 +
| Data Type
 +
| Type
 +
| [[dbo.OrderNumber_(type)|dbo.OrderNumber]]
 +
 +
|
 +
|
 +
|-
 +
| Select
 +
| Table
 +
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Update
 +
| Table
 +
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Update
 +
| Table
 +
| [[Sales.SalesPerson_(table)|Sales.SalesPerson]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Update
 +
| Table
 +
| [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Execute
 +
| Procedure
 +
| [[dbo.uspLogError_(procedure)|dbo.uspLogError]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Execute
 +
| Procedure
 +
| [[dbo.uspPrintError_(procedure)|dbo.uspPrintError]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Execute
 +
| Function
 +
| [[dbo.ufnGetAccountingEndDate_(function)|dbo.ufnGetAccountingEndDate]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Execute
 +
| Function
 +
| [[dbo.ufnGetAccountingStartDate_(function)|dbo.ufnGetAccountingStartDate]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|}
 +
 +
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Reference Type
 +
| '''Object Type
 +
| '''Referencing Object
 +
 +
| '''Child Type
 +
| '''Child Object
 +
 +
|-
 +
| Select
 +
| View
 +
| [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]]
 +
 +
|
 +
|
 +
|-
 +
| Select
 +
| Table
 +
| [[Sales.SalesOrderDetail_(table)|Sales.SalesOrderDetail]]
 +
 +
| Trigger
 +
| iduSalesOrderDetail
 +
|-
 +
| Update
 +
| Table
 +
| [[Sales.SalesOrderDetail_(table)|Sales.SalesOrderDetail]]
 +
 +
| Trigger
 +
| iduSalesOrderDetail
 +
|-
 +
| Select
 +
| Table
 +
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|-
 +
| Update
 +
| Table
 +
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]]
 +
 +
| Trigger
 +
| uSalesOrderHeader
 +
|}
 +
 +
 +
 
== automatically generated ==
 
== automatically generated ==
  

Revision as of 22:55, 28 December 2009

wikibot

Table Sales.SalesOrderHeader
Description General sales order information.


Column Data Type Nullable Default Description / PK / Index
SalesOrderID int not null Primary key.
PK_SalesOrderHeader_SalesOrderID
RevisionNumber tinyint not null ((0)) Incremental number to track changes to the sales order over time.
OrderDate datetime not null (getdate()) Dates the sales order was created.
DueDate datetime not null Date the order is due to the customer.
ShipDate datetime null Date the order was shipped to the customer.
Status tinyint not null ((1)) Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled
OnlineOrderFlag dbo.Flag not null ((1)) 0 = Order placed by sales person. 1 = Order placed online by customer.
SalesOrderNumber Unique sales order identification number.
AK_SalesOrderHeader_SalesOrderNumber
PurchaseOrderNumber dbo.OrderNumber null Customer purchase order number reference.
AccountNumber dbo.AccountNumber null Financial accounting number reference.
CustomerID int not null Customer identification number. Foreign key to Customer.CustomerID.
IX_SalesOrderHeader_CustomerID
ContactID int not null Customer contact identification number. Foreign key to Contact.ContactID.
SalesPersonID int null Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.
IX_SalesOrderHeader_SalesPersonID
TerritoryID int null Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.
BillToAddressID int not null Customer billing address. Foreign key to Address.AddressID.
ShipToAddressID int not null Customer shipping address. Foreign key to Address.AddressID.
ShipMethodID int not null Shipping method. Foreign key to ShipMethod.ShipMethodID.
CreditCardID int null Credit card identification number. Foreign key to CreditCard.CreditCardID.
CreditCardApprovalCode varchar(15) null Approval code provided by the credit card company.
CurrencyRateID int null Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.
SubTotal money not null ((0.00)) Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.
TaxAmt money not null ((0.00)) Tax amount.
Freight money not null ((0.00)) Shipping cost.
TotalDue Total due from customer. Computed as Subtotal + TaxAmt + Freight.
Comment nvarchar(128) null Sales representative comments.
rowguid uniqueidentifier not null (newid()) ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
AK_SalesOrderHeader_rowguid
ModifiedDate datetime not null (getdate()) Date and time the record was last updated.


Relation Column Referenced Column
Person.Address BillToAddressID AddressID
Person.Address ShipToAddressID AddressID
Person.Contact ContactID ContactID
Sales.CreditCard CreditCardID CreditCardID
Sales.CurrencyRate CurrencyRateID CurrencyRateID
Sales.Customer CustomerID CustomerID
Sales.SalesPerson SalesPersonID SalesPersonID
Sales.SalesTerritory TerritoryID TerritoryID
Purchasing.ShipMethod ShipMethodID ShipMethodID


Detail Table Column Referencing Column
Sales.SalesOrderDetail SalesOrderID SalesOrderID
Sales.SalesOrderHeaderSalesReason SalesOrderID SalesOrderID


Triggers Type
uSalesOrderHeader ON UPDATE


Dependency Type Object Type Referenced Object Child Type Child Object
Data Type Type dbo.AccountNumber
Data Type Type dbo.Flag
Data Type Type dbo.OrderNumber
Select Table Sales.SalesOrderHeader Trigger uSalesOrderHeader
Update Table Sales.SalesOrderHeader Trigger uSalesOrderHeader
Update Table Sales.SalesPerson Trigger uSalesOrderHeader
Update Table Sales.SalesTerritory Trigger uSalesOrderHeader
Execute Procedure dbo.uspLogError Trigger uSalesOrderHeader
Execute Procedure dbo.uspPrintError Trigger uSalesOrderHeader
Execute Function dbo.ufnGetAccountingEndDate Trigger uSalesOrderHeader
Execute Function dbo.ufnGetAccountingStartDate Trigger uSalesOrderHeader


Reference Type Object Type Referencing Object Child Type Child Object
Select View Sales.vSalesPersonSalesByFiscalYears
Select Table Sales.SalesOrderDetail Trigger iduSalesOrderDetail
Update Table Sales.SalesOrderDetail Trigger iduSalesOrderDetail
Select Table Sales.SalesOrderHeader Trigger uSalesOrderHeader
Update Table Sales.SalesOrderHeader Trigger uSalesOrderHeader


automatically generated

Table Sales.SalesOrderHeader
Description General sales order information.


Column Data Type Nullable Default Description / PK / Index
SalesOrderID int not null Primary key.
PK_SalesOrderHeader_SalesOrderID
RevisionNumber tinyint not null (0) Incremental number to track changes to the sales order over time.
OrderDate datetime not null (GETDATE()) Dates the sales order was created.
DueDate datetime not null Date the order is due to the customer.
ShipDate datetime null Date the order was shipped to the customer.
Status tinyint not null (1) Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled
OnlineOrderFlag Flag not null (1) 0 = Order placed by sales person. 1 = Order placed online by customer.
SalesOrderNumber Unique sales order identification number.
AK_SalesOrderHeader_SalesOrderNumber
PurchaseOrderNumber OrderNumber null Customer purchase order number reference.
AccountNumber AccountNumber null Financial accounting number reference.
CustomerID int not null Customer identification number. Foreign key to Customer.CustomerID.
IX_SalesOrderHeader_CustomerID
ContactID int not null Customer contact identification number. Foreign key to Contact.ContactID.
SalesPersonID int null Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.
IX_SalesOrderHeader_SalesPersonID
TerritoryID int null Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.
BillToAddressID int not null Customer billing address. Foreign key to Address.AddressID.
ShipToAddressID int not null Customer shipping address. Foreign key to Address.AddressID.
ShipMethodID int not null Shipping method. Foreign key to ShipMethod.ShipMethodID.
CreditCardID int null Credit card identification number. Foreign key to CreditCard.CreditCardID.
CreditCardApprovalCode varchar(15) null Approval code provided by the credit card company.
CurrencyRateID int null Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.
SubTotal money not null (0.00) Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.
TaxAmt money not null (0.00) Tax amount.
Freight money not null (0.00) Shipping cost.
TotalDue Total due from customer. Computed as Subtotal + TaxAmt + Freight.
Comment nvarchar(128) null Sales representative comments.
rowguid uniqueidentifier not null (NEWID()) ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
AK_SalesOrderHeader_rowguid
ModifiedDate datetime not null (GETDATE()) Date and time the record was last updated.


Relation Column Referenced Column
Person.Address BillToAddressID AddressID
Person.Address ShipToAddressID AddressID
Person.Contact ContactID ContactID
Sales.CreditCard CreditCardID CreditCardID
Sales.CurrencyRate CurrencyRateID CurrencyRateID
Sales.Customer CustomerID CustomerID
Sales.SalesPerson SalesPersonID SalesPersonID
Sales.SalesTerritory TerritoryID TerritoryID
Purchasing.ShipMethod ShipMethodID ShipMethodID


Detail Table Column Referencing Column
Sales.SalesOrderDetail SalesOrderID SalesOrderID
Sales.SalesOrderHeaderSalesReason SalesOrderID SalesOrderID


Triggers Type
uSalesOrderHeader ON UPDATE


Dependency Type Object Type Referenced Object Child Type Child Object
Data Type Type dbo.AccountNumber
Data Type Type dbo.Flag
Data Type Type dbo.OrderNumber
Schema Schema Sales
Select Table Sales.SalesOrderHeader Trigger uSalesOrderHeader
Update Table Sales.SalesOrderHeader Trigger uSalesOrderHeader
Update Table Sales.SalesPerson Trigger uSalesOrderHeader
Update Table Sales.SalesTerritory Trigger uSalesOrderHeader
Execute Procedure dbo.uspLogError Trigger uSalesOrderHeader
Execute Procedure dbo.uspPrintError Trigger uSalesOrderHeader
Execute Function dbo.ufnGetAccountingEndDate Trigger uSalesOrderHeader
Execute Function dbo.ufnGetAccountingStartDate Trigger uSalesOrderHeader


Reference Type Object Type Referencing Object Child Type Child Object
Select View Sales.vSalesPersonSalesByFiscalYears
Select Table Sales.SalesOrderDetail Trigger iduSalesOrderDetail
Update Table Sales.SalesOrderDetail Trigger iduSalesOrderDetail
Select Table Sales.SalesOrderHeader Trigger uSalesOrderHeader
Update Table Sales.SalesOrderHeader Trigger uSalesOrderHeader