How do you find the error, how can you know the number of rows affected by last SQL Statement?

Q

How do you find the error, how can you know the number of rows affected by last SQL Statement?

✍: Guest

A

Answer1
@@errors->give the last error occured in the current DB.
Ans. select @@rowcount

Answer2.
Use @@ERROR which returns the error number for the last Transact-SQL statement executed fro knowing the error.
Use @@ROWCOUNT which returns the number of rows affected by the last statement for finding the no of rows affected.

2014-11-03, 1449👍, 0💬