Interview Preparation mode beta
Funny Facebook Status Funny Facebook Status
Enter your email address

What does “SET ROWCOUNT” syntax achieves, in MS SQL Server?

Nice?Vote!
asked 1 year ago in SQL Server Interview Questions and Answers by R (19,530 points) edited 1 year ago by R

1 Answer

Nice?Vote!
"SET ROWCOUNT" limits the number of rows returned. Its looks very similar to "TOP" clause, but there is a major difference the way SQL is executed. The major difference between "SET ROWCOUNT" and "TOP" SQL clause is :-
"SET ROWCOUNT is applied before the order by clause is applied. So if "ORDER BY"clause is specified it will be terminated after the specified number of rows are selected. ORDER BY clause is not executed"
answered 1 year ago by anonymous

Related questions