Question:
In PL/SQL, the following syntax is allowed:
SELECT * FROM table WHERE ROWNUM < 25
This would return the first 24 rows of a table.
Is there anything equivalent to this in T-SQL on Microsoft SQL Server 6.5?
Answer:
No. You can limit the number of rows returned with the set ROWCOUNT = N command. But the command does not work the same way as in Oracle. In Oracle, the where rownum < 25 builds the result set, calculates which are the first 25 rows that would be returned, and returns only those rows. SQL Server doesn't guarantee what 25 rows are returned when the set ROWCOUNT is used.
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.






















