title: counting rows before processing with a cursor tsql
body: <p>I have a SQL Server sp using a cursor thus:</p>
  <pre><code>DECLARE TestCursor CURSOR FOR
      SELECT
          tblHSOutcomes.strOutcomeName, 
          tblHSData.fkHSTest
      FROM
          tblHSData 
          INNER JOIN tblHSOutcomes ON tblHSData.fkOutcome = tblHSOutcomes.uidOutcome 
          INNER JOIN tblHSTests ON tblHSData.fkHSTest = tblHSTests.uidTest
      WHERE
          tblHSData.fkEpisode = @uidHSEpisodes
  
  OPEN TestCursor
      FETCH NEXT FROM TestCursor
      INTO @Result, @TestID
  
  WHILE @@FETCH_STATUS = 0
  BEGIN
  ...etc
  </code></pre>
  <p>It's working fine , however it would be nice to be able to check if the cursors query has any records before continuing to process through it.
  if there a <code>@@</code> var that I can use to check this?</p>
  <p>I know there is <code>@@RowCount</code> - but this has only the current number of rows processed - so isn't very helpful</p>
  <p>Ideally I would like to be able to do something like this:</p>
  <pre><code>if @@cursorQueryHasRecords 
  BEGIN
  WHILE @@FETCH_STATUS = 0
  BEGIN
  ...etc
  </code></pre>
  <p>thanks</p>