SQL Server sorting problem The result is not the desired _mssql
Source: Internet
Author: User
in the Forum, people often ask questions like :
The result set of the same query is sometimes arranged in the order he wants, sometimes not, or in the order of the SQL2000, and in that order of sql2005/2008?
As a matter of fact, SQL Server does not return sequentially as long as the statement does not specify an "order by". Maybe there's a field in your table that's indexed.
You want the result set to be sorted by the field that created the index, then you do not specify "order by" is not a problem, because the table is stored in the order of that field is ordered, so you can not specify "orders by", but if you do not want to sort the field indexed, Or an index is established in the SQL2000, and the index is not indexed in the sql2005/2008, then explicitly specified with an "order by". If you do not specify, even the exact same query,
Result set order this time it's normal to be different from the last one.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service