What is @@rowcount and with small code snippet explain the usage?
Is the foll. code is rite--
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 .

Can u pls explain the above code.

What is @@rowcount and with small code snippet explain the usage?
Is the foll. code is rite--
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 .

Can u pls explain the above code.

Hi yogesh,

@@rowcount returns the number of rows affected by sql statement.

the line : If @@rowcount = 0 checks if rows are returned by your select statement.


if no, procedure returns no rows with emp_id= the empid you passed to the procedure

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.