Microsoft Dynamics NAV - C/SIDE Solution Development -

Microsoft Dynamics NAV – C/SIDE Solution Development

Locus IT ServicesMicrosoft Dynamics NAV – C/SIDE Solution Development

Lesson 8: Bulk Inserts

Bulk Inserts

Bulk Inserts : Microsoft Dynamics NAV automatically buffers inserts to send them to Microsoft SQL Server at one time.

By using bulk inserts, the number of server calls is reduced. This improves performance.

Bulk inserts also improve scalability by delaying the actual insert until the last possible moment in the transaction. This reduces the time that tables are locked, especially tables that contain SIFT indexes.

Software developers who want to write high performance code that uses this feature should understand the following bulk insert constraints.

Bulk Insert Constraints

If you want to write code that uses the bulk insert functionality, you must be aware of the following constraints.Records are sent to SQL Server when the following occurs:

  • You call COMMIT to commit the transaction.
  • You call MODIFY or DELETE on the table.
  • You call any FIND or CALC methods on the table.
  • Records are not buffered if one of the following conditions is TRUE:
  • The application is using the return value from an INSERT call, for example, “IF (GLEntry.INSERT) THEN”. o The table that you insert the records into contains any of the following:
  • BLOB fields
  • Fields that have the AutoIncrement property set to Yes

The following code example cannot use buffered inserts because it contains a FIND call on the GL/Entry table within the loop.


Each call to INSERT, MODIFY, or DELETE functions requires a separate SQL statement. If the table that you modify contains SumIndexes, then the operations are significantly slower. As a test, select a table that contains SumIndexes and execute one hundred INSERT, MODIFY, or DELETE operations to measure how long it takes to maintain the table and all its SumIndexes.

The LOCKTABLE function does not require any separate SQL statements. It only causes any successive reading from the table to lock the table or parts of it.

Locus IT Project Management Office
What’s it?