Specify the TOP Clause in Queries (Visual Database Tools)
Applies to:
SQL Server
The TOP clause returns only the first n or n percent rows from a query. The TOP clause is useful when you want to inspect a portion of your results to find out if your query does what you expect it to do, without taking the resources necessary to return all of the query results.
To specify the TOP clause in queries
Open a query from Solution Explorer or create a new one.
From the View menu, click Properties Window.
In the Properties Window, locate and expand the Top Specification property.
Click the (Top) child property and set it to Yes.
In the Expression child property, type an expression that has a numeric result (for example, "10" or "2*5").
Click the Percent child property and indicate whether or not to treat the Expression property as a percentage of all rows returned (Yes) or as the absolute number of rows returned (No).
If your query uses the ORDER BY clause, click the With Ties child property and choose Yes to display all rows in a group if only part of the group is included or No to truncate them.
As you work through the preceding procedure, notice that the TOP clause, displayed in the SQL pane, changes to reflect the current settings of the properties.
Note
You can also change the values of the child properties of the Top Specification by editing the TOP clause in the SQL pane.
See Also
Design Queries and Views How-to Topics (Visual Database Tools)
Query Properties (Visual Database Tools)
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για