bdhar
bdhar

Reputation: 22973

Lock a table in SQL Server

Is there a command/SQL query to lock a particular table in MS SQL Server to stop all related transactions using ODBC?

Upvotes: 2

Views: 2316

Answers (1)

J__
J__

Reputation: 3837

Use the table hints, such as:

SELECT * FROM MyTable WITH (TABLOCK, HOLDLOCK)

See Table Hints in Books Online for more details.

Upvotes: 3

Related Questions