Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8061075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:12:33+00:00 2026-06-05T10:12:33+00:00

I’m currently running the following statement select * into adhoc..san_savedi from dps_san..savedi_record It’s taking

  • 0

I’m currently running the following statement

select * into adhoc..san_savedi from dps_san..savedi_record

It’s taking a painfully long time and I’d like to see how far along it is so I ran this:

select count(*) from adhoc..san_savedi with (nolock)

That didn’t return anything in a timely manner so for the heck of it I did this:

select top 1 * from adhoc..san_savedi with (nolock)

Even that seems to run indefinitely. I could understand if there are millions of records that the count(*) could take a long time, but I don’t understand why selecting the top 1 record wouldn’t come back pretty much immediately considering I specified nolock.

In the name of full disclosure, dps_san is a view that pulls from an odbc connection via linked server. I don’t think that’d be affecting why I can’t return the top row but just throwing it out there in case I’m wrong.

So I want to know what is keeping that statement from running?

EDIT:

As I mentioned above, yes dps_san..savedi_record is a view. Here’s what it does:

select * from DPS_SAN..root.SAVEDI_RECORD

It’s nothing more than an alias and does no grouping/sorting/etc so I don’t think the problem lies here, but please enlighten me if I’m wrong about that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:12:35+00:00Added an answer on June 5, 2026 at 10:12 am

    SELECT queries with NOLOCK don’t actually take no locks, they still need a SCH-S (schema stability) lock on the table (and as it is a heap it will also take a hobt lock).

    Additionally before the SELECT can even begin SQL Server must compile a plan for the statement, which also requires it to take a SCH-S lock out on the table.

    As your long running transaction creates the table via SELECT ... INTO it holds an incompatible SCH-M lock on it until the statement completes.

    You can verify this by looking in sys.dm_os_waiting_tasks whilst while during the period of blocking.

    When I tried the following in one connection

    BEGIN TRAN
    
    SELECT *
    INTO NewT
    FROM master..spt_values
    
    /*Remember to rollback/commit this later*/
    

    And then executing (or just simply trying to view the estimated execution plan)

    SELECT *
    FROM NewT
    WITH (NOLOCK)
    

    in a second the reading query was blocked.

    SELECT wait_type,
           resource_description
    FROM sys.dm_os_waiting_tasks
    WHERE session_id = <spid_of_waiting_task>
    

    Shows the wait type is indeed SCH_S and the blocking resource SCH-M

    wait_type        resource_description
    ---------------- -------------------------------------------------------------------------------------------------------------------------------
    LCK_M_SCH_S      objectlock lockPartition=0 objid=461960722 subresource=FULL dbid=1 id=lock4a8a540 mode=Sch-M associatedObjectId=461960722
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.