Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORDER BY`

Status
Not open for further replies.

Compkitty

Programmer
Jan 7, 2005
121
US
This is just a general issue/question, I have a statement w/ 3 (ORDER BY) Ie. ORDER BY A ASC, B ASC, C ASC

And it is not sorting correctly... the first several rows are fine, the rest aren't.
could the sort be wrong due to Datatype(s), if so how? and if not.. Is there a way around this??

THANKS
 
Is the data in its correct data type, i.e. is a date in a datetime datatype, integers in int or bigint etc.
This will have a huge impact on your order by clause, and how to fix it is either perform data manipulation (wrong option as performance cost), or to get your data in the correct structure.

An example or your data structure might help with getting a better answer.


"I'm living so far beyond my income that we may almost be said to be living apart
 
Well when originally created the person who admins this; let the system create the datatypes so or the most part they are nvarchar..

and the data

ColA ColB ColC
123 234 0
123 234 1

Etc.
 
Could you post the query and the returned record set? Show us an example of both the correct rows and the incorrect rows?

Thanks,


Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top