Locking in SQL Server

Posted on 2005-04-20
Last Modified: 2012-05-05
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.
Question by:mchetan78
    LVL 23

    Accepted Solution

    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...

    Author Comment

    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.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    Viewers will learn how the fundamental information of how to create a table.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now