How the rowcount works?
sarika
RowCount returns total number of rows affected by last statement execution , you can also preserve and reset rowcount anytime .
Hi,@@ROWCOUNT is a system variable which will return the no of rows affected in the DML operations.The ROWCOUNT is one of the performance tuning mechanism. If you use the below querywhat it does if you have n number of records then it has to be sorted then it will take the 5 records.SELECT TOP 5 * FROM Employees ORDER BY Salary DESCThere is an alternative way to achieve the same result.SET ROWCOUNT 5SELECT * FROM Employees ORDER BY Salary DESCSET ROWCOUNT 0It wont list the entire record. It will get stop when the resultset reach 5 for the current single connection.we have to set ROWCOUNT 0 for release the set count rows. Otherwise it will return the same 5 rows for that connection.But i think there is some impact on DML operations. Yes, if you update the records then it may restrict.