Table: [AdventureWorks2016CTP3].[Production].[ProductInventory]

CollapseAll image

Collapse image Table properties


Name  Value 
 Schema  [Production]
 Owner  [dbo]
 Table is replicated   
 Creation date  23.10.2015
 ID  578101100
 Located on  PRIMARY
 Data size KB  56 KB
 Index size KB  16 KB
 Rows  1069
 ChangeTrackingEnabled   
 FileStreamFileGroup   
 FileStreamPartitionScheme   
 LockEscalation  TABLE
 TrackColumnsUpdatedEnabled   
 Table is filetable   
 Filetable directory   
 Filetable collate   
 Filetable primary key  [PK_ProductInventory_ProductID_LocationID]
 Filetable streamid unique   
 Filetable fullpath unique   
 Filetable is enabled   
 Is memory optimized   
 Durability  SCHEMA_AND_DATA

Collapse image Creation options


Name  Value 
QUOTED_IDENTIFIER ON
ANSI_NULLS ON
ANSI_PADDING ON

Collapse image Columns


    Name  Description  Data type  Max length  Nullable  Default IsGUID  SPARSE Computed value
Primary key Foreign key ProductID     int 4        
Primary key Foreign key LocationID     smallint 2        
    Shelf     nvarchar 10        
    Bin     tinyint 1        
    Quantity     smallint 2   ((0))    
    rowguid     uniqueidentifier 16   (newid())  
    ModifiedDate     datetime 8   (getdate())    
Total: 7 column(s)

Collapse image Indexes


Index  Description  Primary  Unique  Size KB 
[PK_ProductInventory_ProductID_LocationID] ProductID   72 0
Total: 1 Index/indexes

Collapse image Columnstore indexes


No columnstore indexes exist

Collapse image Check constraints


Name  Expression 
CK_ProductInventory_Bin ([Bin]>=(0) AND [Bin]<=(100))
CK_ProductInventory_Shelf ([Shelf] like '[A-Za-z]' OR [Shelf]='N/A')

Collapse image Referenced tables


Table  Primary key or unique constraint  Foreign key 
[Production].[Location] PK_Location_LocationID FK_ProductInventory_Location_LocationID
[Production].[Product] PK_Product_ProductID FK_ProductInventory_Product_ProductID
Total: 2 table(s)

Collapse image Objects that depend on [Production].[ProductInventory]


Object name Object type Dep level
[dbo].[ufnGetStock] Function 1
Total 1 object(s)

Collapse image Objects that [Production].[ProductInventory] depends on


Object name Object type Dep level
[Production] Schema 1
[Production].[Location] Table 1
[Production].[Product] Table 1
Total 3 object(s)

Collapse image Extended properties


Name  Value 
MS_Description Product inventory information.

Collapse image Table options


Name  Value 
Pintable OFF
Table lock on bulk load OFF
Insert row lock OFF
Text in row 0
Large value types out of row OFF

Collapse image SQL


SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
CREATE TABLE [Production].[ProductInventory] (
        [ProductID]        [int] NOT NULL,
        [LocationID]       [smallint] NOT NULL,
        [Shelf]            [nvarchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Bin]              [tinyint] NOT NULL,
        [Quantity]         [smallint] NOT NULL,
        [rowguid]          [uniqueidentifier] NOT NULL ROWGUIDCOL,
        [ModifiedDate]     [datetime] NOT NULL,
        CONSTRAINT [PK_ProductInventory_ProductID_LocationID]
        PRIMARY KEY
        CLUSTERED
        ([ProductID], [LocationID])
    ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key (clustered) constraint', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'PK_ProductInventory_ProductID_LocationID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Clustered index created by a primary key constraint.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'INDEX', N'PK_ProductInventory_ProductID_LocationID'
GO
ALTER TABLE [Production].[ProductInventory]
    ADD
    CONSTRAINT [CK_ProductInventory_Bin]
    CHECK
    ([Bin]>=(0) AND [Bin]<=(100))
GO
EXEC sp_addextendedproperty N'MS_Description', N'Check constraint [Bin] BETWEEN (0) AND (100)', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'CK_ProductInventory_Bin'
GO
ALTER TABLE [Production].[ProductInventory]
CHECK CONSTRAINT [CK_ProductInventory_Bin]
GO
ALTER TABLE [Production].[ProductInventory]
    ADD
    CONSTRAINT [CK_ProductInventory_Shelf]
    CHECK
    ([Shelf] like '[A-Za-z]' OR [Shelf]='N/A')
GO
EXEC sp_addextendedproperty N'MS_Description', N'Check constraint [Shelf] like ''[A-Za-z]'' OR [Shelf]=''N/A''', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'CK_ProductInventory_Shelf'
GO
ALTER TABLE [Production].[ProductInventory]
CHECK CONSTRAINT [CK_ProductInventory_Shelf]
GO
ALTER TABLE [Production].[ProductInventory]
    ADD
    CONSTRAINT [DF_ProductInventory_ModifiedDate]
    DEFAULT (getdate()) FOR [ModifiedDate]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default constraint value of GETDATE()', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'DF_ProductInventory_ModifiedDate'
GO
ALTER TABLE [Production].[ProductInventory]
    ADD
    CONSTRAINT [DF_ProductInventory_Quantity]
    DEFAULT ((0)) FOR [Quantity]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default constraint value of 0', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'DF_ProductInventory_Quantity'
GO
ALTER TABLE [Production].[ProductInventory]
    ADD
    CONSTRAINT [DF_ProductInventory_rowguid]
    DEFAULT (newid()) FOR [rowguid]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Default constraint value of NEWID()', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'DF_ProductInventory_rowguid'
GO
ALTER TABLE [Production].[ProductInventory]
    WITH CHECK
    ADD CONSTRAINT [FK_ProductInventory_Location_LocationID]
    FOREIGN KEY ([LocationID]) REFERENCES [Production].[Location] ([LocationID])
ALTER TABLE [Production].[ProductInventory]
    CHECK CONSTRAINT [FK_ProductInventory_Location_LocationID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Location.LocationID.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'FK_ProductInventory_Location_LocationID'
GO
ALTER TABLE [Production].[ProductInventory]
    WITH CHECK
    ADD CONSTRAINT [FK_ProductInventory_Product_ProductID]
    FOREIGN KEY ([ProductID]) REFERENCES [Production].[Product] ([ProductID])
ALTER TABLE [Production].[ProductInventory]
    CHECK CONSTRAINT [FK_ProductInventory_Product_ProductID]

GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key constraint referencing Product.ProductID.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'CONSTRAINT', N'FK_ProductInventory_Product_ProductID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Storage container on a shelf in an inventory location.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'Bin'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Inventory location identification number. Foreign key to Location.LocationID. ', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'LocationID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date and time the record was last updated.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'ModifiedDate'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Product identification number. Foreign key to Product.ProductID.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'ProductID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Quantity of products in the inventory location.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'Quantity'
GO
EXEC sp_addextendedproperty N'MS_Description', N'ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'rowguid'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Storage compartment within an inventory location.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', 'COLUMN', N'Shelf'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Product inventory information.', 'SCHEMA', N'Production', 'TABLE', N'ProductInventory', NULL, NULL
GO

Collapse image See also


List of tables