Specifying a Locking Scheme

To specify the locking scheme for a table, use the keyword lock and one of: allpages locking, datapages locking, datarows locking.

  • Allpages locking – locks data pages and the indexes affected by queries.

  • Datapages locking – locks only data pages.

  • Datarows locking – locks only data rows.

If you do not specify a locking scheme, the default locking scheme for the server is used. The server-wide default is set with the configuration parameter lock scheme.

You can use alter table to change the locking scheme for a table.