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.
Who is Participating?
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...
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.