dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Three Ways to Limit Your Results in SQL Server 2016

Learn more about three ways in which you can easily limit your query results.


advertisement

The query below uses TOP to select the TOP 3 students:

TOP

SELECT TOP 3 *
FROM Students;

The code below uses LIMIT to only show three records:

SELECT StudentName, StudentPercentage
FROM Students
LIMIT 3;

The query below uses RowNum to only show records 1 to 3

SELECT *
FROM Students
WHERE StudentPercentage  85 AND ROWNUM <= 3;

 

Visit the DevX Tip Bank

 



   
Thanks for your registration, follow us on our social networks to keep up-to-date