Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

select statement with no results is producing locks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
franzbrown@yahoo.com - 04 Jul 2008 18:38 GMT
If I have a select statement that produces no results, what sort of
locks could it still potentially generate?
Russell Fields - 04 Jul 2008 19:00 GMT
Franzbrown,

You can still expect shared locks.  I did a query to do a scan of a large
table, but returning no rows, and got:

SELECT * FROM TableName WHERE Column LIKE '%xyz%'

   1 - S (Shared) lock
   3 - IS (Intent Shared) locks
   4 - Sch-S (Schema Stability) locks

SELECT * FROM TableName WITH (NOLOCK) WHERE Column LIKE '%xyz%'

   1 - S (Shared) lock
   7 - Sch-S (Schema Stability) locks

You can read about the meanings of these locks at:
http://technet.microsoft.com/en-us/library/ms187749.aspx and for more
information http://technet.microsoft.com/en-us/library/ms190615.aspx

RLF

> If I have a select statement that produces no results, what sort of
> locks could it still potentially generate?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.