title: Getting no. of rows affected after running select query in SQL Server 2005
body: <p>Below is my query </p>
  
  <pre><code>select    
  @monNameStr as [MName],             
  IsNull(count(c.AssignmentID),0),                
  IsNull(sum(s.ACV),0),               
  IsNull(sum(s.GrossReturn),0),               
  IsNull(sum(s.NetReturn),0),             
  IsNull(avg(a.Total),0)          
  FROM
  
  dbo.Assignment_ClaimInfo c,             
  dbo.Assignment_SettlementInfo s,                
  dbo.Assignment_AdvCharges a         
  
  Where
  c.Assignmentid=s.Assignmentid and               
  s.Assignmentid=a.Assignmentid and               
  a.Assignmentid in                   
  
  (select AssignmentID from dbo.Assignment_ClaimInfo                  
  where (upper(InsuranceComp)=upper(@CompName) or upper(@CompName)='ALL COMPANIES') 
  and (DateName(month,DATEADD(month, 0, DOFileClosed))+' '
  +cast(year(DATEADD(month, 0, DOFileClosed)) as varchar)=@monNameStr))
  Group By c.InsuranceComp
  Order By c.InsuranceComp
  
  where @monNameStr is calculated date field like 'October 2009'
  </code></pre>
  
  <p>What i need to know the no. of records affected by this select query.</p>
  
  <p>I DONT NEED TO NEST THIS QUERY TO ANOTHER QUERY WITH COUNT() FUNCTION.</p>
  
  <p>Your valuable help is appreciated.</p>