title: T-SQL CURSOR with blank output
body: <p>Working on SQL CURSOR and encounter blank output amongst right output. Check on pubs database and got the blank output too. Script for pubs</p>
  
  <pre><code>DECLARE @auid varchar(30)
  DECLARE CURSOR_AuthorTitle CURSOR FOR
      SELECT au_id FROM authors order by au_lname
  OPEN CURSOR_AuthorTitle
      FETCH NEXT FROM CURSOR_AuthorTitle INTO @auid 
      WHILE @@Fetch_Status = 0 
      BEGIN
          ;With authortitle_id as 
          (SELECT a.au_id, title_id, au_fname, au_lname, royaltyper 
          FROM authors a, titleauthor ta 
          WHERE a.au_id=ta.au_id) 
  
          SELECT 'Author Name' =  au_fname +' ' + au_lname, 'Book Title'= title 
          FROM authorTitle_id at, titles t 
          WHERE at.title_id=t.title_id and au_id=@auid   
          ORDER BY au_lname
  
      FETCH NEXT FROM CURSOR_AuthorTitle INTO @auid
      END
  CLOSE CURSOR_AuthorTitle
  DEALLOCATE CURSOR_AuthorTitle
  </code></pre>
  
  <p>Got the author &amp; book list, but with some blank outputs as well.  I want to get rid of the blank output.  Thanks for your help in advance.</p>