MERCHANDISEPRODUCTINSTANCEHISTORY
Primary Key
| Primary Key | Field Type | 
|---|---|
| ID | uniqueidentifier | 
Fields
| Field | Field Type | Null | Notes | Description | 
|---|---|---|---|---|
| SOURCETYPECODE | tinyint | Default = 0 | ||
| SOURCETYPE | nvarchar(6) (Computed) | yes | CASE [SOURCETYPECODE] WHEN 0 THEN N'Manual' WHEN 1 THEN N'Batch' END | |
| ACTIONTYPECODE | tinyint | Default = 0 | ||
| ACTIONTYPE | nvarchar(14) (Computed) | yes | CASE [ACTIONTYPECODE] WHEN 0 THEN N'Shipment' WHEN 1 THEN N'Adjustment' WHEN 2 THEN N'Physical count' END | |
| ACTIONDATE | datetimeoffset | |||
| ONHANDQUANTITY | int | Default = 0 | ||
| COST | decimal(20, 4) | yes | Default = 0 | |
| AVERAGECOST | decimal(20, 4) | yes | Default = 0 | |
| SALEPRICE | decimal(20, 4) | yes | Default = 0 | |
| DATEADDED | datetime | Default = getdate() | ||
| DATECHANGED | datetime | Default = getdate() | ||
| TS | timestamp | |||
| TSLONG | bigint (Computed) | yes | CONVERT(bigint, TS) | |
| QUANTITY | int | Default = 0 | ||
| COMMENTS | nvarchar(255) | Default = '' | 
Foreign Keys
| Foreign Key | Field Type | Null | Notes | Description | 
|---|---|---|---|---|
| MERCHANDISEPRODUCTINSTANCEID | uniqueidentifier | MERCHANDISEPRODUCTINSTANCE.ID | ||
| BATCHID | uniqueidentifier | yes | BATCH.ID | |
| VENDORID | uniqueidentifier | yes | VENDOR.ID | |
| MERCHANDISEADJUSTMENTREASONCODEID | uniqueidentifier | yes | MERCHANDISEADJUSTMENTREASONCODE.ID | |
| ADDEDBYID | uniqueidentifier | CHANGEAGENT.ID | ||
| CHANGEDBYID | uniqueidentifier | CHANGEAGENT.ID | 
Indexes
| Index Name | Fields | Unique | Primary | Clustered | 
|---|---|---|---|---|
| IX_MERCHANDISEPRODUCTINSTANCEHISTORY_DATEADDED | DATEADDED | yes | ||
| IX_MERCHANDISEPRODUCTINSTANCEHISTORY_DATECHANGED | DATECHANGED | |||
| IX_MERCHANDISEPRODUCTINSTANCEHISTORY_MERCHANDISEPRODUCTINSTANCEID | MERCHANDISEPRODUCTINSTANCEID | |||
| PK_MERCHANDISEPRODUCTINSTANCEHISTORY | ID | yes | yes | 
Triggers
| Trigger Name | Description | 
|---|---|
| TR_MERCHANDISEPRODUCTINSTANCEHISTORY_AUDIT_UPDATE | |
| TR_MERCHANDISEPRODUCTINSTANCEHISTORY_AUDIT_DELETE |