# Record.LockTable([Boolean] [, Boolean]) Method
> Version: _Available or changed with runtime version 1.0._
Starts locking on a table to protect it from write transactions that conflict with each other.
## Syntax
```al
 Record.LockTable([Wait: Boolean] [, VersionCheck: Boolean])
```
## Parameters
Record
Type: record-data-type
An instance of the record-data-type data type.
*[Optional] Wait*
Type: ../boolean/boolean-data-type
Specifies what to do if the table is already locked. If this parameter is true and if another application has already locked the table, the system will wait until the table is unlocked. If this parameter is false and if another application has already locked the table, a run-time error occurs.
*[Optional] VersionCheck*
Type: ../boolean/boolean-data-type
If this parameter is true, the version of the Record will be checked. If this parameter is false, blank, or not used, the version will not be checked.
## Remarks
Read scale-out lets databases offload read-only workloads to read-only replicas, isolating them from the main read-write workload to improve performance. See Using read scale-out for better performance<../../../administration/database-read-scale-out-overview>.
LockTable behaves differently depending on whether read scale-out is used. If the session doesn't use read scale-out, LockTable does these actions:
1. Starts a transaction.
1. Makes sure that all subsequent statements that read data apply an UPDLOCK on the database.
If the session uses Read Scale-Out, LockTable does the following:
1. Makes sure that all subsequent statements that read data use REPEATABLEREAD on the database.
Because all write operations automatically lock the table that is being used, LockTable would appear unnecessary. However, you could have a transaction in which an application wants to inspect data before possibly changing it, with a guarantee that the data being changed has not been modified by other applications since the read operation. The solution is to explicitly lock the table before the read operation. This makes sure that no other application makes changes between the read operation and the possible write operation.
The table lock is released (unlocked) when the transaction is committed.
This method works the same as the RecordRef ../recordref/recordref-locktable-method.
## Related information
record-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>
../../../administration/optimize-sql-al-database-methods-and-performance-on-server

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-locktable-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-locktable-method/
