title: How to SELECT COUNT from tables currently being INSERT?
body: <p>Hi consider there is an INSERT statement running on a table TABLE_A, which takes a long time, I would like to see how has it progressed.</p>
  
  <p>What I tried was to open up a new session (new query window in SSMS) while the long running statement is still in process, I ran the query</p>
  
  <pre><code>SELECT COUNT(1) FROM TABLE_A WITH (nolock)
  </code></pre>
  
  <p>hoping that it will return right away with the number of rows everytime I run the query, but the test result was even with (nolock), still, it only returns after the INSERT statement is completed.</p>
  
  <p>What have I missed? Do I add (nolock) to the INSERT statement as well? Or is this not achievable?</p>
  
  <hr>
  
  <p>(Edit)
  OK, I have found what I missed. If you first use CREATE TABLE TABLE_A, then INSERT INTO TABLE_A, the SELECT COUNT will work. If you use SELECT * INTO TABLE_A FROM xxx, without first creating TABLE_A, then non of the following will work (not even sysindexes).</p>