Salesline is locked during batch import Sales Orders

philipvphilipv Member Posts: 4
Hi,

I have designed a dataport which imports new sales orders from a text file(header and lines) with no special functionality.
During this import which may be half and hour long all the other users cannot insert new sales lines.
It seems that salesline table is locked.
After debugging I have found that when one line inserted in sales line all the other users cannot insert new line in sales line.
I cannot understand this behavior.I'm working on 3.70.b and SQL server.
During insert i know that there is a lock but on the specified record.
How can other users that work on different records can be locked ?
The same think does not occur in Sales Header.

Comments

  • lessilessi Member Posts: 33
    Hi,

    With native database, you lock the table while inserting.

    With SQL Server, because you surely not filter the dataitem, you also lock the table. But even if you filter it, SQL will lock the table to optimize the insert.

    Regards.
  • krikikriki Member, Moderator Posts: 9,118
    1) In the OnInsert-trigger of table 37 is a LOCKTABLE. If you use the insert-triggers, this blocks the whole table.

    2) SQL starts with record-locking. But if he notices that it is more performant, he will switch to page-locking and also to table-locking. There is no way to control this behaviour.


    The best way is to do a COMMIT after some records. But of course in case of an error, some records can be written to the DB and if you restart the import, these records must not be inserted again.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.