Microsoft SQL Server ResourcesSorting Records in a SQL Server View

Provided by: Michelle Swann-Renee, EVP Professional Solutions Group


Many times developers need to order items in a view rather than using a stored procedure. However, adding an order by clause to a view generates an error.

To get around this, use the TOP key word to select the items and add the Order By clause.


To select a list of employees and order the results from oldest to youngest, you would use the following SQL:

Select TOP 100 Percent LastName, FirstName, Title, BirthDate From Employees Order By BirthDate

To retrieve a specific number of rows avoid the PERCENT:

Select TOP 25 LastName, FirstName, Title, BirthDate From Employees Order By BirthDate

Go to the tips page

Strategic Overview

SQL Server Express

SQL Azure Cloud

What it Means to Information Workers

Link Microsoft Access to SQL Azure Databases

Deploy MS Access DBs linked to SQL Azure

Eliminate SQL Azure Security Holes

Monitor SQL Server Usage and DTU Limits on Azure

Convet Azure SQL Server to Elastic Pools

SQL Server Tips

Database Users and Permissions

Database Backup and Restore on Network

AM/PM Date Time Format

Get Date Portion


Running Total


Migrate Your Data Tier to SQL Server: Strategies for Survival

Microsoft Access Database and Migration Challenges

Are we there yet? Successfully navigating the bumpy road from Access to SQL Server

Visual Studio LightSwitch

LightSwitch Introduction

Comparison Matrix


Microsoft SQL Server Consulting Services

Visual Studio .NET programmers for web development

General Microsoft Access consulting services

Additional Resources

Microsoft Access Help

Microsoft Access Developer Help Center

MS Access Developer Programming

More Access and SQL Tips

Technical Papers

Microsoft Access Tools

Connect with Us


Free Product Catalog from FMS