• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

Locking in SQL Server

I have put a query in SQL Query Analyzer Select top 17777* from <Table name> It takes lot of time to get the output.I stopped it using stop button in Query analyser. Now that process ID is blocking any other query to be executed on the same table. This does not happen everytime. But I would like to know if someone is facing the same problem.
0
mchetan78
Asked:
mchetan78
1 Solution
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
Check the following:

1) Make sure your table has an clustered key.
2) Use (WITH NOLOCK) to do dirty reads which helps prevent deadlocks

Hope this helped...
0
 
mchetan78Author Commented:
Thanks for your comment..Pls find my replies to your comments.
1. I have a clustered key on the table.
2.Using WITH NOLOCK option does help in preventing this problem.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now