Below is my query
select @monNameStr as [MName], IsNull(count(c.AssignmentID),0), IsNull(sum(s.ACV),0), IsNu
You can just use `@@ROWCOUNT` to get the records affected/returned DECLARE @rowsreturned INT SET @rowsreturned = @@ROWCOUNT