Why do we use SET ROWCOUNT in Sql ?

 Posted by Bharathi Cherukuri on 4/30/2012 | Category: Sql Server Interview questions | Views: 2067 | Points: 40
Answer:

This syntax is used in SQL Server to stop processing the query after the specified number of rows are returned.

Example:

SELECT * FROM EMPLOYEES

- It will return 10 rows of records.

After add SET ROWCOUNT
SET ROWCOUNT 5
SELECT * FROM EMPLOYEES
- It will return 5 rows of records instead of 10 row.
(Bacause you set the RowCount to 5)


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response