How to get return rowcount from stored proceedure - SQL Server 2012 -
i writing stored procedure in sql server 2012 , facing problem while reading number of rows stored procedure return after matching conditions , join criteria.
my stored procedure is:
select distinct count(crs.courseid) over() recordcounts, crs.courseid, crs.coursename, crs.coursedescription, (select coursegroupname coursegroup cgrp cgrp.coursegroupid = crs.coursegroupid) category courses crs inner join courserequests creq on crs.courseid = creq.courseid crs.coursename <> ''''
it returning 16 "recordcounts" 1 of condition, in actual, result 3 rows only.
can me this?
thanks
below screenshot give more clear idea problem 1 of condition:
try this:
;with cte as( select distinct crs.courseid, crs.coursename, crs.coursedescription, (select coursegroupname coursegroup cgrp cgrp.coursegroupid = crs.coursegroupid) category courses crs inner join courserequests creq on crs.courseid = creq.courseid crs.coursename <> '''') select *, (select count(courseid) cte) recordcounts cte