Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

This question came up in a discussion at work... given the following T-SQL statement:

select firstname, lastname from users order by lastname;

the default sort order on the order by clause is asc.

Is there a setting within SQL Server that will allow you to change the default order used when the ASC|DESC modifiers are not specified?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

No, the default sort order is always ASC.

share|improve this answer
4  
which is required by the SQL standard if I'm not mistaken (but that wouldn't bother Microsoft on the other hand...) –  a_horse_with_no_name Feb 14 '13 at 22:02
7  
@a_horse_with_no_name I think 5-10 years ago that would have been a fair statement, but they've been much better in recent versions at actually paying attention to the standards. They've at least stopped violating them, and I welcome extensions they add over and above what the standard defines. –  Aaron Bertrand Feb 14 '13 at 22:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.