Knowledgebase
[QODBC-Desktop] How to use Batch Statements with QODBC
Posted by Juliet (QODBC Support) on 04 June 2010 07:44 AM

How to use Batch Statements with QODBC

Note: There are three stored procedures for batch statements which are SP_BATCHCLEAR, SP_BATCHSTART, SP_BATCHUPDATE.

SP_BATCHCLEAR

Syntax and Instruction

SP_BATCHCLEAR tablename - Clears any cached batch statements for the given table. This is an execute the query and does not return a recordset.

Example

SP_BATCHCLEAR Customer

 

SP_BATCHSTART

Syntax and Instruction

SP_BATCHSTART tablename - Starts batch mode inserts/updates for a given table. All inserts or updates issued after this statement on this table will be cached and not transmitted to QuickBooks until the SP_BATCHUPDATE command is issued. This is an execute the command and does not return a recordset.

Example

SP_BATCHSTART Customer

SP_BATCHUPDATE

Syntax and Instruction

SP_BATCHUPDATE tablename - Submits a batch of previously cached inserts/updates for a given table. All inserts or updates issued since the sp_batchstart statement will be transmitted to QuickBooks. Use sp_lastinsertID to retrieve the status of the batch update. This is an execute the command and does not return a recordset.

Example

SP_BATCHUPDATE Customer

 

A Complete Example

BatchStart
sp_batchstart InvoiceLine

BatchInsert1
INSERT INTO "InvoiceLine" ("CustomerRefListID", "RefNumber",
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache")
VALUES ('AC0000-1197757899', 'Batch1', '250000-933272656', 'Bin Permit Renovations',
200.00000, 200.00, '20000-999022286', 0)

BatchInsert2
INSERT INTO "InvoiceLine" ("CustomerRefListID", "RefNumber",
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache")
VALUES ('AC0000-1197757899', 'Batch2', '250000-933272656', 'Bin Permit Renovations',
200.00000, 200.00, '20000-999022286', 0)

BatchUpdate
sp_batchupdate InvoiceLine

(146 vote(s))
Helpful
Not helpful

Comments (4)
Jim Johnson
12 October 2016 01:53 PM
Looking at your example fro "How to use Batch Statements with QODBC"
Is this to be one long statements that is executed once or does each statement need executed individually?
Jack
14 October 2016 11:51 AM
Hi Jim,

You can execute statement individually through Batch Statements.
rizwan
05 June 2017 05:43 AM
what if i need to insert a new lined invoice to existing invoice?
Jack
05 June 2017 06:36 AM
Hi Rizwan,

Please refer below mentioned link for How to insert InvoiceLine item to an existing Invoice:
http://support.flexquarters.com/esupport/index.php?/Knowledgebase/Article/View/2542/0/how-to-insert-invoiceline-item-to-an-existing-invoice
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please complete the captcha below (we use this to prevent automated submissions).