|
[QODBC Desktop] Writing UPDATE Queries in QODBC - Timestamp Syntax and Common Field Flags
Posted by William - QODBC Support on 01 October 2026 12:32 PM
|
|||||||||
[QODBC Desktop] Writing UPDATE Queries in QODBC - Timestamp Syntax and Common Field FlagsProblem Description:QODBC read-write users need to update field values across multiple QuickBooks tables (e.g., PurchaseOrder, Invoice, CreditMemo, SalesOrder) using SQL UPDATE statements. A common stumbling block is using the wrong date/time format for the Affected products: QODBC Desktop Read-Write, QuickBooks Desktop (Enterprise, Pro, Premier) Symptoms:
Cause:
Environment:
Solution:
UPDATE PurchaseOrder SET IsManuallyClosed = False WHERE TimeCreated >= {ts '2017-01-01 00:00:00.000'} AND TimeCreated <= {ts '2022-01-01 00:00:00.000'}
UPDATE PurchaseOrder SET IsManuallyClosed = 1 WHERE TimeCreated >= {ts '2017-01-01 00:00:00.000'} AND TimeCreated <= {ts '2022-01-01 00:00:00.000'} AND IsFullyReceived = 0 AND IsManuallyClosed = 0 AND TotalAmount > 0
UPDATE Invoice SET IsToBePrinted = False, IsToBeEmailed = False WHERE TimeCreated >= {ts '2027-01-01 00:00:00.000'} AND TimeCreated <= {ts '2027-12-31 00:00:00.000'} UPDATE SalesOrder SET IsToBePrinted = False, IsToBeEmailed = False WHERE TimeCreated >= {ts '2027-01-01 00:00:00.000'} AND TimeCreated <= {ts '2027-12-31 00:00:00.000'} UPDATE CreditMemo SET IsToBePrinted = False, IsToBeEmailed = False WHERE TimeCreated >= {ts '2003-01-01 00:00:00.000'} AND TimeCreated <= {ts '2027-12-31 00:00:00.000'}
SELECT TxnID, TimeCreated, IsManuallyClosed, TotalAmount FROM PurchaseOrder WHERE TimeCreated >= {ts '2017-01-01 00:00:00.000'} AND TimeCreated <= {ts '2022-01-01 00:00:00.000'} AND IsFullyReceived = 0 AND IsManuallyClosed = 0 SQL Examples:Update a single record by transaction ID (faster, more precise): UPDATE PurchaseOrder SET IsManuallyClosed = 0 WHERE TxnId = 'BF7F-1828866559' Update IsManuallyClosed across a date range with all guard clauses: UPDATE PurchaseOrder SET IsManuallyClosed = 1 WHERE TimeCreated >= {ts '2017-01-01 00:00:00.000'} AND TimeCreated <= {ts '2022-01-01 00:00:00.000'} AND IsFullyReceived = 0 AND IsManuallyClosed = 0 AND TotalAmount > 0 Example Scenarios:Scenario 1 - Closing 40,000+ Purchase Orders: A customer with over 40,000 records needed to set IsManuallyClosed and various flag fields on historical purchase orders. After learning to use timestamp format for TimeCreated (instead of the date format that caused data type mismatch), they ran UPDATE queries with TotalAmount > 0 and IsManuallyClosed = 0 guard clauses. Records with TotalAmount = 0 (~380 rows) were handled manually in the QuickBooks UI. Scenario 2 - Bulk flag updates on Invoices: A customer needed to clear IsToBePrinted and IsToBeEmailed flags on thousands of invoices across a date range. They used a single UPDATE with timestamp syntax and verified the row count with a matching SELECT before committing. Additional Notes:
Related Articles:How are dates formatted in SQL queries when using the QuickBooks generated timestamps QODBC Read-Write - Enabling UPDATE and DELETE Operations Keywords:QODBC UPDATE Query Timestamp Format TimeCreated IsManuallyClosed IsToBePrinted IsToBeEmailed Data Type Mismatch Error 3210 PurchaseOrder Invoice CreditMemo SalesOrder Bulk Update Read-Write License
| |||||||||
|
|
|||||||||


