Difference between revisions of "Sales.SalesOrderHeader (table)"
Line 282: | Line 282: | ||
| ON UPDATE | | ON UPDATE | ||
|} | |} | ||
− | |||
== automatically generated == | == automatically generated == | ||
Line 304: | Line 303: | ||
| '''Nullable | | '''Nullable | ||
| '''Default | | '''Default | ||
− | | '''Description | + | | '''Description / PK / Index |
− | |||
− | |- | + | |- valign="top" |
| SalesOrderID | | SalesOrderID | ||
| int | | int | ||
| not null | | not null | ||
| | | | ||
− | | Primary key. | + | | Primary key.PK_SalesOrderHeader_SalesOrderID |
− | + | |- valign="top" | |
− | |- | ||
| RevisionNumber | | RevisionNumber | ||
| tinyint | | tinyint | ||
Line 320: | Line 317: | ||
| (0) | | (0) | ||
| Incremental number to track changes to the sales order over time. | | Incremental number to track changes to the sales order over time. | ||
− | + | |- valign="top" | |
− | |- | ||
| OrderDate | | OrderDate | ||
| datetime | | datetime | ||
Line 327: | Line 323: | ||
| (GETDATE()) | | (GETDATE()) | ||
| Dates the sales order was created. | | Dates the sales order was created. | ||
− | + | |- valign="top" | |
− | |- | ||
| DueDate | | DueDate | ||
| datetime | | datetime | ||
Line 334: | Line 329: | ||
| | | | ||
| Date the order is due to the customer. | | Date the order is due to the customer. | ||
− | + | |- valign="top" | |
− | |- | ||
| ShipDate | | ShipDate | ||
| datetime | | datetime | ||
Line 341: | Line 335: | ||
| | | | ||
| Date the order was shipped to the customer. | | Date the order was shipped to the customer. | ||
− | + | |- valign="top" | |
− | |- | ||
| Status | | Status | ||
| tinyint | | tinyint | ||
Line 348: | Line 341: | ||
| (1) | | (1) | ||
| Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled | | Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled | ||
− | + | |- valign="top" | |
− | |- | ||
| OnlineOrderFlag | | OnlineOrderFlag | ||
| Flag | | Flag | ||
Line 355: | Line 347: | ||
| (1) | | (1) | ||
| 0 = Order placed by sales person. 1 = Order placed online by customer. | | 0 = Order placed by sales person. 1 = Order placed online by customer. | ||
− | + | |- valign="top" | |
− | |- | ||
| SalesOrderNumber | | SalesOrderNumber | ||
| | | | ||
| | | | ||
| | | | ||
− | | Unique sales order identification number. | + | | Unique sales order identification number.AK_SalesOrderHeader_SalesOrderNumber |
− | + | |- valign="top" | |
− | |- | ||
| PurchaseOrderNumber | | PurchaseOrderNumber | ||
| OrderNumber | | OrderNumber | ||
Line 369: | Line 359: | ||
| | | | ||
| Customer purchase order number reference. | | Customer purchase order number reference. | ||
− | + | |- valign="top" | |
− | |- | ||
| AccountNumber | | AccountNumber | ||
| AccountNumber | | AccountNumber | ||
Line 376: | Line 365: | ||
| | | | ||
| Financial accounting number reference. | | Financial accounting number reference. | ||
− | + | |- valign="top" | |
− | |- | ||
| CustomerID | | CustomerID | ||
| int | | int | ||
| not null | | not null | ||
| | | | ||
− | | Customer identification number. Foreign key to Customer.CustomerID. | + | | Customer identification number. Foreign key to Customer.CustomerID.IX_SalesOrderHeader_CustomerID |
− | + | |- valign="top" | |
− | |- | ||
| ContactID | | ContactID | ||
| int | | int | ||
Line 390: | Line 377: | ||
| | | | ||
| Customer contact identification number. Foreign key to Contact.ContactID. | | Customer contact identification number. Foreign key to Contact.ContactID. | ||
− | + | |- valign="top" | |
− | |- | ||
| SalesPersonID | | SalesPersonID | ||
| int | | int | ||
| null | | null | ||
| | | | ||
− | | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID. | + | | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.IX_SalesOrderHeader_SalesPersonID |
− | + | |- valign="top" | |
− | |- | ||
| TerritoryID | | TerritoryID | ||
| int | | int | ||
Line 404: | Line 389: | ||
| | | | ||
| Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. | | Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. | ||
− | + | |- valign="top" | |
− | |- | ||
| BillToAddressID | | BillToAddressID | ||
| int | | int | ||
Line 411: | Line 395: | ||
| | | | ||
| Customer billing address. Foreign key to Address.AddressID. | | Customer billing address. Foreign key to Address.AddressID. | ||
− | + | |- valign="top" | |
− | |- | ||
| ShipToAddressID | | ShipToAddressID | ||
| int | | int | ||
Line 418: | Line 401: | ||
| | | | ||
| Customer shipping address. Foreign key to Address.AddressID. | | Customer shipping address. Foreign key to Address.AddressID. | ||
− | + | |- valign="top" | |
− | |- | ||
| ShipMethodID | | ShipMethodID | ||
| int | | int | ||
Line 425: | Line 407: | ||
| | | | ||
| Shipping method. Foreign key to ShipMethod.ShipMethodID. | | Shipping method. Foreign key to ShipMethod.ShipMethodID. | ||
− | + | |- valign="top" | |
− | |- | ||
| CreditCardID | | CreditCardID | ||
| int | | int | ||
Line 432: | Line 413: | ||
| | | | ||
| Credit card identification number. Foreign key to CreditCard.CreditCardID. | | Credit card identification number. Foreign key to CreditCard.CreditCardID. | ||
− | + | |- valign="top" | |
− | |- | ||
| CreditCardApprovalCode | | CreditCardApprovalCode | ||
| varchar(15) | | varchar(15) | ||
Line 439: | Line 419: | ||
| | | | ||
| Approval code provided by the credit card company. | | Approval code provided by the credit card company. | ||
− | + | |- valign="top" | |
− | |- | ||
| CurrencyRateID | | CurrencyRateID | ||
| int | | int | ||
Line 446: | Line 425: | ||
| | | | ||
| Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. | | Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. | ||
− | + | |- valign="top" | |
− | |- | ||
| SubTotal | | SubTotal | ||
| money | | money | ||
Line 453: | Line 431: | ||
| (0.00) | | (0.00) | ||
| Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. | | Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. | ||
− | + | |- valign="top" | |
− | |- | ||
| TaxAmt | | TaxAmt | ||
| money | | money | ||
Line 460: | Line 437: | ||
| (0.00) | | (0.00) | ||
| Tax amount. | | Tax amount. | ||
− | + | |- valign="top" | |
− | |- | ||
| Freight | | Freight | ||
| money | | money | ||
Line 467: | Line 443: | ||
| (0.00) | | (0.00) | ||
| Shipping cost. | | Shipping cost. | ||
− | + | |- valign="top" | |
− | |- | ||
| TotalDue | | TotalDue | ||
| | | | ||
Line 474: | Line 449: | ||
| | | | ||
| Total due from customer. Computed as Subtotal + TaxAmt + Freight. | | Total due from customer. Computed as Subtotal + TaxAmt + Freight. | ||
− | + | |- valign="top" | |
− | |- | ||
| Comment | | Comment | ||
| nvarchar(128) | | nvarchar(128) | ||
Line 481: | Line 455: | ||
| | | | ||
| Sales representative comments. | | Sales representative comments. | ||
− | + | |- 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. | + | | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.AK_SalesOrderHeader_rowguid |
− | + | |- valign="top" | |
− | |- | ||
| ModifiedDate | | ModifiedDate | ||
| datetime | | datetime | ||
Line 495: | Line 467: | ||
| (GETDATE()) | | (GETDATE()) | ||
| Date and time the record was last updated. | | Date and time the record was last updated. | ||
− | |||
|} | |} | ||
Line 570: | Line 541: | ||
| uSalesOrderHeader | | uSalesOrderHeader | ||
| ON UPDATE | | ON UPDATE | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Referenced Object | ||
+ | | '''Object Type | ||
+ | | '''Dependency Type | ||
+ | |||
+ | |- | ||
+ | | [[dbo.AccountNumber_(type)|dbo.AccountNumber]] | ||
+ | | Type | ||
+ | | Data Type | ||
+ | |- | ||
+ | | [[dbo.Flag_(type)|dbo.Flag]] | ||
+ | | Type | ||
+ | | Data Type | ||
+ | |- | ||
+ | | [[dbo.OrderNumber_(type)|dbo.OrderNumber]] | ||
+ | | Type | ||
+ | | Data Type | ||
+ | |- | ||
+ | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
+ | | Table | ||
+ | | Select | ||
+ | |- | ||
+ | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
+ | | Table | ||
+ | | Update | ||
+ | |- | ||
+ | | [[Sales.SalesPerson_(table)|Sales.SalesPerson]] | ||
+ | | Table | ||
+ | | Update | ||
+ | |- | ||
+ | | [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]] | ||
+ | | Table | ||
+ | | Update | ||
+ | |- | ||
+ | | [[dbo.uspLogError_(procedure)|dbo.uspLogError]] | ||
+ | | Procedure | ||
+ | | Execute | ||
+ | |- | ||
+ | | [[dbo.uspPrintError_(procedure)|dbo.uspPrintError]] | ||
+ | | Procedure | ||
+ | | Execute | ||
+ | |- | ||
+ | | [[dbo.ufnGetAccountingEndDate_(function)|dbo.ufnGetAccountingEndDate]] | ||
+ | | Function | ||
+ | | Execute | ||
+ | |- | ||
+ | | [[dbo.ufnGetAccountingStartDate_(function)|dbo.ufnGetAccountingStartDate]] | ||
+ | | Function | ||
+ | | Execute | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- style="background:silver" | ||
+ | | '''Referencing Object | ||
+ | | '''Object Type | ||
+ | | '''Reference Type | ||
+ | |||
+ | |- | ||
+ | | [[Sales.vSalesPersonSalesByFiscalYears_(view)|Sales.vSalesPersonSalesByFiscalYears]] | ||
+ | | View | ||
+ | | Select | ||
+ | |- | ||
+ | | [[Sales.SalesOrderDetail_(table)|Sales.SalesOrderDetail]] | ||
+ | | Table | ||
+ | | Select | ||
+ | |- | ||
+ | | [[Sales.SalesOrderDetail_(table)|Sales.SalesOrderDetail]] | ||
+ | | Table | ||
+ | | Update | ||
+ | |- | ||
+ | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
+ | | Table | ||
+ | | Select | ||
+ | |- | ||
+ | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
+ | | Table | ||
+ | | Update | ||
|} | |} |
Revision as of 23:58, 26 November 2009
wikibot
Table | Sales.SalesOrderHeader |
Column | Data Type | Nullable | Default | PK | Index |
SalesOrderID | int | not null | PK_SalesOrderHeader_SalesOrderID | ||
RevisionNumber | tinyint | not null | ((0)) | ||
OrderDate | datetime | not null | (getdate()) | ||
DueDate | datetime | not null | |||
ShipDate | datetime | null | |||
Status | tinyint | not null | ((1)) | ||
OnlineOrderFlag | dbo.Flag | not null | ((1)) | ||
SalesOrderNumber | AK_SalesOrderHeader_SalesOrderNumber | ||||
PurchaseOrderNumber | dbo.OrderNumber | null | |||
AccountNumber | dbo.AccountNumber | null | |||
CustomerID | int | not null | IX_SalesOrderHeader_CustomerID | ||
ContactID | int | not null | |||
SalesPersonID | int | null | IX_SalesOrderHeader_SalesPersonID | ||
TerritoryID | int | null | |||
BillToAddressID | int | not null | |||
ShipToAddressID | int | not null | |||
ShipMethodID | int | not null | |||
CreditCardID | int | null | |||
CreditCardApprovalCode | varchar(15) | null | |||
CurrencyRateID | int | null | |||
SubTotal | money | not null | ((0.00)) | ||
TaxAmt | money | not null | ((0.00)) | ||
Freight | money | not null | ((0.00)) | ||
TotalDue | |||||
Comment | nvarchar(128) | null | |||
rowguid | uniqueidentifier | not null | (newid()) | AK_SalesOrderHeader_rowguid | |
ModifiedDate | datetime | not null | (getdate()) |
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 |
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 |
Referenced Object | Object Type | Dependency Type |
dbo.AccountNumber | Type | Data Type |
dbo.Flag | Type | Data Type |
dbo.OrderNumber | Type | Data Type |
Sales.SalesOrderHeader | Table | Select |
Sales.SalesOrderHeader | Table | Update |
Sales.SalesPerson | Table | Update |
Sales.SalesTerritory | Table | Update |
dbo.uspLogError | Procedure | Execute |
dbo.uspPrintError | Procedure | Execute |
dbo.ufnGetAccountingEndDate | Function | Execute |
dbo.ufnGetAccountingStartDate | Function | Execute |
Referencing Object | Object Type | Reference Type |
Sales.vSalesPersonSalesByFiscalYears | View | Select |
Sales.SalesOrderDetail | Table | Select |
Sales.SalesOrderDetail | Table | Update |
Sales.SalesOrderHeader | Table | Select |
Sales.SalesOrderHeader | Table | Update |