Question on MSSQL select statement?

KokKeong

New Member
will a table been lock up while i perform a select statement and only release when MSSQL finish execution of that statement?<br />
 

DayTripper

New Member
Right. You'd have to "manually" lock/unlock the table. But you usually only want to do that when you make an UPDATE to the table, not a SELECT.
 

Shaka_DaMan

New Member
Well it depends on the locking scheme that you are using with the database. On any case the whole table will not lock, however there is always the potentional for that data page you are selecting could be locked and have to wait until your select was finished for a transaction to grab that same data page.

As a good practice it's always a practice to use the WITH (NOLOCK) hint

Example

SELECT * FROM TableName WITH (NOLOCK)

You can also specify the (NOLOCK) hint directly after the TableName
 
Top