# Table: SalesOrderHeaderSalesReason

## Properties

Property | Value
--- | ---
Name | SalesOrderHeaderSalesReason
ID | 1266103551
Owner | dbo
Schema | Sales
Filegroup | PRIMARY
Data Size (KB) | 688 KB
Index Size (KB) | 16 KB
Rows | 27647
Unused (KB) | 72 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:42 PM
Create Date | 8/8/2010 5:21:52 PM

## Extended Properties

Name | Value
--- | ---
MS_Description | Cross-reference table mapping sales orders to sales reason codes.

## Columns

Column ID | Column Name | Datatype | Nullable | Is Sparse | Is Column Set
--- | --- | --- | --- | --- | ---
1 | SalesOrderID | int |  |  |
2 | SalesReasonID | int |  |  |
3 | ModifiedDate | datetime |  |  |

## Identity Columns

No identity columns defined.

## Primary Key Constraints

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

## Primary Key Columns

Name
SalesOrderID
SalesReasonID

## Foreign Keys

Name | Referenced Object | Update Action | Delete Action
--- | --- | --- | ---
FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID | Sales.SalesReason | No action | No action
FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID | Sales.SalesOrderHeader | No action | Cascade

## Column Level Check Constraints

No column constraints defined.

## Table Level Check Constraints

No table constraints defined.

## Default Constraints

Name | Column | Definition | Is System Named | Extended Property Name | Extended Property Value
--- | --- | --- | --- | --- | ---
DF_SalesOrderHeaderSalesReason_ModifiedDate | ModifiedDate | (getdate()) |  | MS_Description | Default constraint value of GETDATE()

## Indexes

Name | Index Type | Primary Key | Unique | Unique Constraint | Ignore Duplicate Key | Disabled
--- | --- | --- | --- | --- | --- | ---
PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID | CLUSTERED |  |  |  |  |

## FullText Indexes

No fulltext indexes defined.

## Referencing Tables

No referencing tables defined.

## 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_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID | Aug 8 2010 5:23PM | 27647 | 27647 | 111 | 0.8349497 | 8 |  |  | 27647

### Detailed Statistics Density

All Density | Average Length | Columns
--- | --- | ---
4.345559E-05 | 4 | SalesOrderID
3.617029E-05 | 8 | SalesOrderID, SalesReasonID

### Detailed Statistics Histogram

Range High Key | Range Rows | Estimated Rows | Distinct Range Rows | Avg Range Rows
--- | --- | --- | --- | ---
43697 | 0 | 2 | 0 | 1
43783 | 124 | 2 | 62 | 2
43995 | 186 | 2 | 93 | 2
44056 | 82 | 2 | 41 | 2
44200 | 126 | 2 | 63 | 2
44414 | 254 | 2 | 127 | 2
44596 | 126 | 2 | 63 | 2
44685 | 126 | 2 | 63 | 2
45102 | 446 | 2 | 223 | 2
45193 | 126 | 2 | 63 | 2
45452 | 254 | 2 | 127 | 2
45595 | 126 | 2 | 63 | 2
45696 | 126 | 2 | 63 | 2
45862 | 190 | 2 | 95 | 2
45957 | 126 | 2 | 63 | 2
46130 | 126 | 2 | 63 | 2
46234 | 126 | 2 | 63 | 2
46443 | 190 | 2 | 95 | 2
46546 | 126 | 2 | 63 | 2
46681 | 78 | 1 | 39 | 2
47750 | 319 | 1 | 319 | 1
48454 | 191 | 1 | 191 | 1
49177 | 255 | 1 | 255 | 1
49774 | 255 | 1 | 255 | 1
51178 | 490 | 2 | 490 | 1
51298 | 116 | 3 | 96 | 1.208333
51666 | 361 | 3 | 284 | 1.271127
52005 | 161 | 2 | 139 | 1.158273
52137 | 129 | 2 | 118 | 1.09322
52275 | 154 | 3 | 131 | 1.175573
52465 | 201 | 3 | 178 | 1.129213
52614 | 157 | 3 | 139 | 1.129496
52833 | 223 | 3 | 206 | 1.082524
53047 | 208 | 2 | 187 | 1.112299
53131 | 92 | 3 | 78 | 1.179487
53241 | 107 | 2 | 94 | 1.138298
53329 | 88 | 2 | 83 | 1.060241
53434 | 107 | 2 | 95 | 1.126316
53717 | 109 | 3 | 92 | 1.184783
53825 | 106 | 3 | 99 | 1.070707
53967 | 147 | 3 | 124 | 1.185484
54172 | 206 | 2 | 186 | 1.107527
54359 | 191 | 1 | 161 | 1.186335
54515 | 157 | 3 | 140 | 1.121429
54628 | 112 | 2 | 103 | 1.087379
55025 | 418 | 1 | 358 | 1.167598
55228 | 195 | 2 | 181 | 1.077348
55456 | 124 | 2 | 115 | 1.078261
55552 | 96 | 3 | 84 | 1.142857
55700 | 164 | 2 | 137 | 1.19708
55918 | 221 | 3 | 199 | 1.110553
56022 | 113 | 1 | 94 | 1.202128
56261 | 258 | 3 | 228 | 1.131579
56952 | 729 | 3 | 637 | 1.144427
57232 | 96 | 3 | 87 | 1.103448
57581 | 358 | 3 | 316 | 1.132911
58787 | 1267 | 2 | 1088 | 1.164522
59079 | 127 | 2 | 100 | 1.27
59510 | 449 | 1 | 378 | 1.187831
60066 | 577 | 1 | 501 | 1.151697
60203 | 127 | 1 | 117 | 1.08547
60510 | 320 | 2 | 268 | 1.19403
60758 | 254 | 2 | 221 | 1.149321
60825 | 64 | 3 | 58 | 1.103448
61075 | 260 | 2 | 221 | 1.176471
61341 | 191 | 1 | 161 | 1.186335
61525 | 178 | 2 | 163 | 1.092025
61646 | 126 | 3 | 108 | 1.166667
61939 | 298 | 2 | 269 | 1.107807
62118 | 191 | 1 | 159 | 1.201258
62581 | 463 | 2 | 405 | 1.14321
63100 | 556 | 3 | 481 | 1.155925
63413 | 137 | 3 | 123 | 1.113821
63618 | 206 | 2 | 181 | 1.138122
63741 | 127 | 1 | 105 | 1.209524
64321 | 594 | 1 | 510 | 1.164706
64982 | 684 | 1 | 599 | 1.141903
65076 | 103 | 3 | 85 | 1.211765
65381 | 127 | 1 | 114 | 1.114035
65501 | 126 | 3 | 103 | 1.223301
65914 | 436 | 1 | 369 | 1.181572
65991 | 74 | 2 | 69 | 1.072464
66107 | 127 | 1 | 103 | 1.23301
66236 | 127 | 1 | 113 | 1.123894
66312 | 83 | 3 | 66 | 1.257576
66430 | 126 | 3 | 107 | 1.17757
67139 | 722 | 2 | 638 | 1.131661
67353 | 127 | 1 | 108 | 1.175926
67861 | 511 | 1 | 450 | 1.135556
68480 | 639 | 1 | 552 | 1.157609
68710 | 255 | 1 | 217 | 1.175115
69140 | 413 | 2 | 364 | 1.134615
69383 | 254 | 2 | 216 | 1.175926
69694 | 132 | 2 | 117 | 1.128205
69971 | 279 | 2 | 246 | 1.134146
70132 | 149 | 2 | 139 | 1.071942
70393 | 261 | 2 | 229 | 1.139738
70570 | 191 | 1 | 159 | 1.201258
70746 | 146 | 2 | 133 | 1.097744
71120 | 383 | 1 | 327 | 1.171254
71273 | 146 | 3 | 123 | 1.186992
71535 | 266 | 2 | 237 | 1.122363
71681 | 155 | 3 | 131 | 1.183206
71995 | 131 | 3 | 115 | 1.13913
72326 | 340 | 2 | 298 | 1.14094
72859 | 575 | 1 | 471 | 1.220807
72993 | 133 | 2 | 121 | 1.099174
74332 | 1374 | 1 | 1183 | 1.161454
75053 | 767 | 1 | 705 | 1.087943
75122 | 76 | 1 | 66 | 1.151515
75123 | 0 | 1 | 0 | 1

### Detailed Statistics General

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

### Detailed Statistics Density

All Density | Average Length | Columns
--- | --- | ---
0.1428571 | 4 | SalesReasonID

### Detailed Statistics Histogram

Range High Key | Range Rows | Estimated Rows | Distinct Range Rows | Avg Range Rows
--- | --- | --- | --- | ---
1 | 0 | 17473 | 0 | 1
2 | 0 | 3515 | 0 | 1
4 | 0 | 722 | 0 | 1
5 | 0 | 1746 | 0 | 1
6 | 0 | 1245 | 0 | 1
9 | 0 | 1551 | 0 | 1
10 | 0 | 1395 | 0 | 1

## Objects that depend on [SalesOrderHeaderSalesReason]

- Sales.SalesOrderHeaderSalesReason

## Objects on which [SalesOrderHeaderSalesReason] depends

- Sales.SalesOrderHeaderSalesReason
  - Sales.SalesOrderHeader
    - Sales.Customer
      - Sales.Store
        - Sales.SalesPerson
          - HumanResources.Employee
            - Person.Person
              - Person.BusinessEntity
              - Person.AdditionalContactInfoSchemaCollection
              - Demographics.exist
              - Person.IndividualSurveySchemaCollection
              - dbo.Name
              - dbo.NameStyle
            - dbo.Flag
          - Sales.SalesTerritory
            - Person.CountryRegion
        - Sales.StoreSurveySchemaCollection
      - dbo.ufnLeadingZeros
    - Person.Address
      - Person.StateProvince
    - Sales.CurrencyRate
      - Sales.Currency
    - Purchasing.ShipMethod
    - dbo.uspLogError
      - dbo.ErrorLog
      - dbo.uspPrintError
    - Sales.CreditCard
    - dbo.AccountNumber
    - dbo.OrderNumber
    - dbo.ufnGetAccountingEndDate
    - dbo.ufnGetAccountingStartDate
  - Sales.SalesReason

## SQL

Script
SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE TABLE [Sales].[SalesOrderHeaderSalesReason]( [SalesOrderID] [int] NOT NULL, [SalesReasonID] [int] NOT NULL, [ModifiedDate] [datetime] NOT NULL ) ON [PRIMARY] EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Primary key. Foreign key to SalesOrderHeader.SalesOrderID.' , @level0type=N'SCHEMA',@level0name=N'Sales', @level1type=N'TABLE',@level1name=N'SalesOrderHeaderSalesReason', @level2type=N'COLUMN',@level2name=N'SalesOrderID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Primary key. Foreign key to SalesReason.SalesReasonID.' , @level0type=N'SCHEMA',@level0name=N'Sales', @level1type=N'TABLE',@level1name=N'SalesOrderHeaderSalesReason', @level2type=N'COLUMN',@level2name=N'SalesReasonID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Date and time the record was last updated.' , @level0type=N'SCHEMA',@level0name=N'Sales', @level1type=N'TABLE',@level1name=N'SalesOrderHeaderSalesReason', @level2type=N'COLUMN',@level2name=N'ModifiedDate' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Cross-reference table mapping sales orders to sales reason codes.' , @level0type=N'SCHEMA',@level0name=N'Sales', @level1type=N'TABLE',@level1name=N'SalesOrderHeaderSalesReason'

#### See also

List of Tables