Locktable with Navision 3.70 under Microsoft SQL Server 2000
oarnaudon
Member Posts: 9
Hi,
i've a big problem using Navision 3.70 and SQL Server 2000.
OnAfterGetRecord of my report :
Object : i try to insert 2000 records in a table ; before every insert, i check if the record exist or not. I do the same think for the both session, and the key wich contain "USERID" is different for each session.
When this report is running into 2 different sessions, while the insert as not finished in the first session, the second session don't start, because the record "Buffer Stock" is locked.
When IF NOT "Buffer Stock Keys".GET is disabled, it works great.
I think, the GET locked the table.
Did someone have an issue to this problem ?
Thanks a lot !
Best regards,
Oliver[/i]
i've a big problem using Navision 3.70 and SQL Server 2000.
OnAfterGetRecord of my report :
IF NOT "Buffer Stock Keys".GET(FORMAT(Mysess."ID connexion"),FORMAT(i),USERID) THEN BEGIN "Buffer stock".INIT; "Buffer stock"."Code 1" := FORMAT(Mysess."ID connexion"); "Buffer stock"."Code 2" := FORMAT(i); "Buffer stock"."Code utilisateur" := USERID; "Buffer stock".INSERT; END;
Object : i try to insert 2000 records in a table ; before every insert, i check if the record exist or not. I do the same think for the both session, and the key wich contain "USERID" is different for each session.
When this report is running into 2 different sessions, while the insert as not finished in the first session, the second session don't start, because the record "Buffer Stock" is locked.
When IF NOT "Buffer Stock Keys".GET is disabled, it works great.
I think, the GET locked the table.
Did someone have an issue to this problem ?
Thanks a lot !
Best regards,
Oliver[/i]
0
Comments
-
You don't need the get statement.
just do this
if "Buffer stock".INSERT then;
Also did you look at TransactionType property for the report?0 -
Thanks for your speed-response, but, it's not possible not to use the .GET !
It works on several temporary tables, and i should use .GET !
An another idea ?
Thanks !
Best regards,
Oliver !0 -
well if "Buffer stock".INSERT then returns a true or false if it exists or not.
Also did you look at TransactionType property for the report?0 -
Hi,
the report was only to do some tests.
In the customer database, it's a function in a codeunit.
On the same table we have to use SETRANGE and FIND function.
Sorry if the first post wasn't precise.
We have also post an message in MBS Support, but at this time, no response.
Thanks !
Oliver !0 -
Try using another variable to insert and instead of the get/find variable
"Buffer Stock Keys 2"
IF NOT "Buffer Stock Keys 2".GET(FORMAT(Mysess."ID connexion"),FORMAT(i),USERID) THEN BEGIN
"Buffer stock".INIT;
"Buffer stock"."Code 1" := FORMAT(Mysess."ID connexion");
"Buffer stock"."Code 2" := FORMAT(i);
"Buffer stock"."Code utilisateur" := USERID;
"Buffer stock".INSERT;
END;
here are the rules for locking on sql
SQL Server:
• LOCKTABLE does not lock the table
• GET locks the record until the end of the process if LOCKTABLE, INSERT, MODIFY or DELETE are called first
• FIND, NEXT locks the recordset (+ 1 record above and 1 record below) at the beginning of the loop until the end of the process if LOCKTABLE, INSERT, MODIFY or DELETE are called first
• CALCSUMS locks the SIFT records until the end of the process if LOCKTABLE is called first
• INSERT, MODIFY, DELETE lock the record until the end of the process0 -
I also tried to use another variable, but when the second session begins, i've the same problem !0
-
• FIND, NEXT locks the recordset (+ 1 record above and 1 record below) at the beginning of the loop until the end of the process if LOCKTABLE, INSERT, MODIFY or DELETE are called first
• INSERT, MODIFY, DELETE lock the record until the end of the process
So it looks like one record above your find first get locked and one bellow?0 -
Thanks, i know that the record above and below are locked !
But, is there an issue to this problem ?
With one session there is not a problem, it works, but with two sessions or more the record are blocked !
Thanks !0 -
are you doing anything else beside this in the routine.
SQL uses record level locking first, if it become too complicated to maintain Serializability it changes to Table level locking.
What do you mean withWith one session there is not a problem, it works, but with two sessions or more the record are blocked
Do you mean the record or the table?0 -
what means Serializability ?0
-
0
-
oarnaudon wrote:Thanks, i know that the record above and below are locked !
Since Navision 4.0SP1 it is not true! It is on SQL what will lock - record, page, table etc...
I know, that you are talking about 3.70 but I want that you know... ;-)
And the problem of locking can be hidden in bad keys. Becouse if you are inserting something, the part of key which will be updated is locked. Try to disable all keys which are beginning with something other than USERID (you can set MaintainSQLIndex to No for the keys, not delete them). If you will have only key with this first field, only tha part for the one ID will be locked, but it is hard to assume, what will SQL do...0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

