Northwind Database (Document! X Sample)
AdventureWorks Database / Production Schema / Production.TransactionHistoryArchive Table
In This Topic
    Production.TransactionHistoryArchive Table
    In This Topic
    Description
    Transactions for previous years.
    Properties
    Creation Date27/10/2017 14:33
    File GroupPRIMARY
    Text File Group
    System Object
    Published for Replication
    Rows89253
    Data Space Used4,992.00 KB
    Index Space Used3,144.00 KB
    Columns
     Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
    Primary Key Primary key for TransactionHistoryArchive records.Integer4   
     Product identification number. Foreign key to Product.ProductID.Integer4   
     Purchase order, sales order, or work order identification number.Integer4   
     Line number associated with the purchase order, sales order, or work order.Integer4 
    ((0))
     
     Date and time of the transaction.DBTimeStamp4 
    (getdate())
     
     W = Work Order, S = Sales Order, P = Purchase OrderWChar1   
     Product quantity.Integer4   
     Product cost.Currency8   
     Date and time the record was last updated.DBTimeStamp4 
    (getdate())
     
    Indexes
    IndexDescriptionPrimaryUnique
    Nonclustered index.  
    Nonclustered index.  
    Primary key (clustered) constraint
    Check Constraints
    NameDescriptionExpression
    Check constraint [TransactionType]='p' OR [TransactionType]='s' OR [TransactionType]='w' OR [TransactionType]='P' OR [TransactionType]='S' OR [TransactionType]='W'
    (upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W')
    SQL
    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON
    CREATE TABLE [Production].[TransactionHistoryArchive](
        [TransactionID] [int] NOT NULL,
        [ProductID] [int] NOT NULL,
        [ReferenceOrderID] [int] NOT NULL,
        [ReferenceOrderLineID] [int] NOT NULL,
        [TransactionDate] [datetime] NOT NULL,
        [TransactionType] [nchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Quantity] [int] NOT NULL,
        [ActualCost] [money] NOT NULL,
        [ModifiedDate] [datetime] NOT NULL,
     CONSTRAINT [PK_TransactionHistoryArchive_TransactionID] PRIMARY KEY CLUSTERED 
    (
        [TransactionID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    ALTER TABLE [Production].[TransactionHistoryArchive] ADD  CONSTRAINT [DF_TransactionHistoryArchive_ReferenceOrderLineID]  DEFAULT ((0)) FOR [ReferenceOrderLineID]
    ALTER TABLE [Production].[TransactionHistoryArchive] ADD  CONSTRAINT [DF_TransactionHistoryArchive_TransactionDate]  DEFAULT (getdate()) FOR [TransactionDate]
    ALTER TABLE [Production].[TransactionHistoryArchive] ADD  CONSTRAINT [DF_TransactionHistoryArchive_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
    ALTER TABLE [Production].[TransactionHistoryArchive]  WITH CHECK ADD  CONSTRAINT [CK_TransactionHistoryArchive_TransactionType] CHECK  ((upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W'))
    ALTER TABLE [Production].[TransactionHistoryArchive] CHECK CONSTRAINT [CK_TransactionHistoryArchive_TransactionType]
    See Also