How does locktable actualy work ?

BgestelBgestel Member Posts: 136
edited 2008-02-08 in SQL Performance
Table 37 OnInsert()

TestStatusOpen;
IF Quantity <> 0 THEN
ReserveSalesLine.VerifyQuantity(Rec,xRec);
DocDim.LOCKTABLE;
LOCKTABLE;
SalesHeader."No." := '';

DimMgt.InsertDocDim(
DATABASE::"Sales Line","Document Type","Document No.","Line No.",
"Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");


Above you can see te code that is in the cronus oninsert trigger. Docdim is a local variable btw. so the only statement thats applies on it is the locktable.

In the dimensionmanagement (DimMgt) CU there are no Locktable statement also there are no Findset(true) statements. As you see it does not take the docdim as a parrameter.

Everybody still keeping up :?:

Now when i put some stress on the code i get blocks on the document dimension table. 2seconds and up.

It is a sql 2005 i'm using. And i allready changed the order off the clustered key.


Isn't it strange that the locktable is set on a local variable in the calling table and locks the records from the codeunit.
**********************
** SI ** Bert Van Gestel **
**********************

Comments

Sign In or Register to comment.