INSERT function

The purpose of the INSERT function is to add new records to a table. The syntax for the INSERT function is as follows:

[BooleanValue :=] Record.INSERT ( [ TriggerControlBoolean ] )

If BooleanValue is not used and the INSERT function fails (for example, if the insertion would result in a duplicate Primary Key), the process will terminate with an error. Generally, we should handle a detected error in code using the BooleanValue and supplying our own error-handling logic, rather than allow a default termination.

The TriggerControlBoolean value controls whether or not the table's OnInsert trigger fires when the INSERT occurs. The default value is FALSE. If we let the default FALSE control, we run the risk of not performing error checking that the table's designer assumed would be run when a new record was added.

When we are reading a table, and we also need to INSERT records into that same table, the INSERT should be done to a separate instance of the table. We can use either a global or local variable for that second instance. If we INSERT into the same table we are reading, we run the risk of reading the new records as part of our processing (likely a very confusing action). We also run the risk of changing the sequence of our processing unexpectedly due to the introduction of new records into our dataset. While the database access methods are continually improved by Microsoft, and this warning may be overcautious, it is better to be safe than sorry.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.163.31