LOCKTABLE

pmrioux
Member Posts: 13
Hello everybody!
Quick question for you guys. At the beginning of the "OnInsert" trigger of table Sales Line, we have the following three commands :
KitSalesLine.LOCKTABLE;
DocDim.LOCKTABLE;
LOCKTABLE;
Is that a good idea ?! Are they necessary ?
Regards,
PM
Quick question for you guys. At the beginning of the "OnInsert" trigger of table Sales Line, we have the following three commands :
KitSalesLine.LOCKTABLE;
DocDim.LOCKTABLE;
LOCKTABLE;
Is that a good idea ?! Are they necessary ?
Regards,
PM
0
Comments
-
Have you googled on LOCKTABLE with NAV?
This is kind of a strange command and started its life in the old Navision Native database.
What it meant in these days was lock the entire table now.
It does no longer mean that.
Nowadays it means, "whatever rows you read in the table, lock those".
So the statement should be renamed by Microsoft to LOCKROWS
And yes, it is probably a good idea.0 -
Andwian wrote:What if we do not use LOCKTABLE?
Is it dangerous?
Can it cause data inconsistency?
Does it not 'lock' the rows automatically?
Thank you.
I'd say yes, depends on what you call consistent, and yes. Using locktable defines the explicit starting point of a transaction. The actual locking takes place when you read rows, or when you insert/modify them. The use of a certain sequence of locktable/read access is required to get deterministic posting behaviour, and to avoid deadlocks. As for consistency, this is another matter. In CU 12, the G/L Entry table is deliberately marked as consistent depending on a calculation. This will be checked on commit and an error raised when it's not marked consistent.
with best regards
Jens0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions