What is @@rowcount ?

 Posted by Bharathi Cherukuri on 5/21/2012 | Category: Sql Server Interview questions | Views: 1930 | Points: 40
Answer:

@@rowcount gives the number of rows given as a result of previous query ran.

Example:

Create procedure get_emp_count ( @emp_id int) 

As Select * from emp where emp_id =@emp_id
If @@rowcount = 0
Begin
Select 'no rows with emp_id= ' Select @emp_id
End


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response