[QODBC-Desktop] Inventory Quantity Fields Show Null Values in QODBC Item Table Queries
Problem Description:
When querying the Item, AssemblyBasedItemLine, or related Item tables via QODBC, columns such as QuantityOnHand, QuantityOnSalesOrders, and QuantityOnPurchaseOrder may return NULL (null) values even though the inventory data is clearly populated in QuickBooks Desktop's Inventory Center.
Affected products: QODBC Desktop, QuickBooks Desktop (all editions) Expected outcome: By using the correct table names and column mappings documented by QODBC, inventory quantity fields return accurate values reflecting current QuickBooks data.
Symptoms:
- SQL queries on the
Item table return NULL for columns named QuantityOnHand, QuantityOnSalesOrders, and QuantityOnPurchaseOrder.
- The same inventory quantities are visible and populated in QuickBooks Desktop's Inventory Center or Item List.
- The issue persists regardless of the query structure - filtering, joining, or selecting different columns does not affect the result.
- Related fields such as
Balance, CurrentBalance, and other financial quantity columns may also show NULL values when queried from Item or related tables.
Cause:
QuickBooks Desktop stores inventory quantities across multiple internal data structures depending on the item type (ItemInventory, ItemGroup, ItemNonInventory, ItemService etc.). QODBC exposes these fields through specific column names that may differ from the intuitive or commonly assumed names.
The primary causes for NULL returns are:
- Column name mismatch: The actual column names in the QODBC schema for Item tables use specific naming conventions that may not match QuickBooks UI labels. For example, the inventory quantity fields on certain item types are only available through the
InventoryAsset or AssemblyBasedItemLine tables rather than the base Item table.
- Item type dependency: Quantity-related columns are populated differently based on the QuickBooks item type. Only certain item types (e.g., ItemInventory) maintain OnHand quantities at the item level; other types (e.g., Service, NonInventory) do not track quantity on hand.
- Table scope: The base
Item table does not always include all quantity breakdown columns. Detailed quantity data resides in specialized sub-tables that must be queried directly or joined to the Item table.
Note
For a complete reference of all Item table columns, including exact column names for Balance, CurrentBalance, QuantityOnHand, and related fields, see the QODBC knowledge base article at QODBC Item Column Reference.
Environment:
| Product | Version / Detail |
| QODBC Desktop |
All versions |
| QuickBooks Desktop |
All editions (Enterprise, Pro, Premier) |
| Data Source Tools |
MS Access (linked tables), Excel Power Query, MS SQL Server linked tables |
Solution:
Step 1: Identify the Correct Item Type and Table
Determine which item type you are querying. Quantity fields are only applicable to ItemInventory items in QuickBooks.
Step 2: Use the Correct Column Names from QODBC Schema
Refer to the documented column mappings for Item-related tables. The inventory quantity data is available in the following locations:
- ItemInventory (base table): Contains the primary
QuantityOnHand field for ItemInventory items.
- AssemblyBasedItemLine: Contains component-level quantity data for assembled items, including
QuantityOnSalesOrders and QuantityOnPurchaseOrder.
- Item (summary table): May include aggregate fields but does not always expose all quantity breakdown columns.
Step 3: Query the Appropriate Table
Instead of querying only the base Item table, query the item-specific tables that contain the detailed quantity data you need:
SQL Examples:
Query Inventory Part Quantity on Hand
SELECT ListID, FullName, QuantityOnHand FROM ItemInventory
Filter by Item Type
SELECT ListID, FullName, QuantityOnHand FROM ItemInventory WHERE QuantityOnHand > 0
Query Quantity on Hand via ItemInventoryAssemblyLine
SELECT ListID, FullName, QuantityOnHand FROM ItemInventoryAssemblyLine
Query Quantity on Hand via ItemInventoryAssembly
SELECT ListID, FullName, QuantityOnhand FROM ItemInventoryAssembly
Join Item with ItemInventory for Complete Data
SELECT
T1.FullName,
T1.Type,
T2.QuantityOnHand
FROM Item T1
Inner JOIN ItemInventory T2 ON T1.ListID = T2.ListID
WHERE T1.Type = 'ItemInventory'
Query Balance and CurrentBalance Fields
SELECT ListID, FullName, SalesPrice, PurchaseCost FROM Item
Example Scenarios:
Scenario 1 - Querying Item table returns null quantities:
A user ran SELECT * FROM Item WHERE Type = 'ItemInventory' and found that QuantityOnHand was NULL for all records. The issue was that the base Item table does not include all quantity breakdown columns for every item type.
After the fix - Querying ItemInventory directly:
The user switched to querying the ItemInventory table directly: SELECT QuantityOnHand FROM ItemInventory. All inventory quantities returned correctly because this table is specifically designed to store item quantity data.
Additional Notes:
- Item type matters: Only ItemInventory items in QuickBooks maintain OnHand quantities. Service, NonInventory, and Group items do not have QuantityOnHand values.
- Assembly items: Assembled Items track quantities through the AssemblyBasedItemLine table, not through the base Item table.
- Balance fields: The Balance and CurrentBalance columns are financial summary fields that may be NULL for items that have never had a transaction (invoice, sales receipt, or adjustment) affecting their balance.
- For complete column reference: See the QODBC knowledge base article at QODBC Item Column Reference for the full list of supported columns across all Item-related tables.
- Optimizer consideration: If quantities appear stale after a recent inventory adjustment in QuickBooks, run
sp_optimizeupdatesync Item to refresh the Optimizer cache before concluding the values are NULL.
Related Articles:
QODBC Item Column Reference Understanding QODBC Optimizer Sync Stored Procedures How to Query Inventory Data via QODBC QuickBooks Item Types Explained
Keywords:
QuantityOnHand QuantityOnSalesOrders QuantityOnPurchaseOrder NULL Item Table ItemInventory AssemblyBasedItemLine Balance CurrentBalance QuickBooks Inventory Inventory Asset MS Access Linked Tables QODBC Schema Item Type OnHand Null
Support Tickets: AFI-762-28613
|