Select top N records in T-SQL / SQL Server

visibility 80 access_time 4 years ago languageEnglish timeline Stats
timeline Stats
Page index 0.11
more_horiz

In different databases, the syntax of selecting top N records are slightly different. They may also differ from ISO standards.

In SQL Server, use TOP (N) to retrieve the first N records in the table. Remember to replace N with one actual number.

Code snippet

SELECT TOP (N) * FROM TableName;
info Last modified by Raymond 4 years ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext
Read and parse JSON in T-SQL / SQL Server
visibility 1,031
thumb_up 1
access_time 4 years ago
Export CSV File from Azure SQL Databases
visibility 1,370
thumb_up 0
access_time 11 months ago