Click here to Skip to main content
15,888,521 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL query Date Sort Problem Pin
AnirbanM 23-Dec-12 19:07
professionalAnirbanM 23-Dec-12 19:07 
GeneralRe: SQL query Date Sort Problem Pin
AnirbanM 23-Dec-12 19:10
professionalAnirbanM 23-Dec-12 19:10 
GeneralRe: SQL query Date Sort Problem Pin
Mycroft Holmes3-Dec-12 19:48
professionalMycroft Holmes3-Dec-12 19:48 
GeneralRe: SQL query Date Sort Problem Pin
AnirbanM 24-Dec-12 2:12
professionalAnirbanM 24-Dec-12 2:12 
GeneralRe: SQL query Date Sort Problem Pin
AnirbanM 24-Dec-12 2:30
professionalAnirbanM 24-Dec-12 2:30 
GeneralRe: SQL query Date Sort Problem Pin
Eddy Vluggen4-Dec-12 3:12
professionalEddy Vluggen4-Dec-12 3:12 
GeneralRe: SQL query Date Sort Problem Pin
AnirbanM 24-Dec-12 3:27
professionalAnirbanM 24-Dec-12 3:27 
GeneralRe: SQL query Date Sort Problem Pin
Eddy Vluggen4-Dec-12 4:44
professionalEddy Vluggen4-Dec-12 4:44 
AnirbanM 2 wrote:
No sir, the sorting is made on 'ToDate' column which is of Date type, not varchar type, as I already given my column types before.

Still, it sorts like it would be. Can you create a TSQL-script that reproduces the problem? Seems I can't, my dates keep returning ordered in a way that could be expected;
SQL
DECLARE @TEST TABLE (SD DATE);
INSERT INTO @TEST (SD) VALUES ('20010101');
INSERT INTO @TEST (SD) VALUES ('20011010');
INSERT INTO @TEST (SD) VALUES ('20010310');
INSERT INTO @TEST (SD) VALUES ('20010210');
INSERT INTO @TEST (SD) VALUES ('20010301');
INSERT INTO @TEST (SD) VALUES ('20010201');
SELECT * FROM @TEST ORDER BY SD;

Results:
2001-01-01
2001-02-01
2001-02-10
2001-03-01
2001-03-10
2001-10-10

Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

AnswerRe: SQL query Date Sort Problem Pin
Michael Potter4-Dec-12 8:11
Michael Potter4-Dec-12 8:11 
AnswerRe: SQL query Date Sort Problem Pin
jschell4-Dec-12 8:23
jschell4-Dec-12 8:23 
Questionoltp vs olap Pin
a.fatemeh2-Dec-12 10:51
a.fatemeh2-Dec-12 10:51 
AnswerRe: oltp vs olap Pin
Mycroft Holmes2-Dec-12 11:49
professionalMycroft Holmes2-Dec-12 11:49 
GeneralRe: oltp vs olap Pin
a.fatemeh2-Dec-12 11:57
a.fatemeh2-Dec-12 11:57 
GeneralRe: oltp vs olap Pin
Mycroft Holmes2-Dec-12 13:28
professionalMycroft Holmes2-Dec-12 13:28 
GeneralRe: oltp vs olap Pin
a.fatemeh2-Dec-12 13:41
a.fatemeh2-Dec-12 13:41 
GeneralSQL instance name when using network group Pin
Aamir Saleem2-Dec-12 10:32
Aamir Saleem2-Dec-12 10:32 
GeneralRe: SQL instance name when using network group Pin
Mycroft Holmes2-Dec-12 11:43
professionalMycroft Holmes2-Dec-12 11:43 
QuestionACL vs SQL for fuzzy matching Pin
Ben Dessau29-Nov-12 4:15
Ben Dessau29-Nov-12 4:15 
AnswerRe: ACL vs SQL for fuzzy matching Pin
Pete O'Hanlon29-Nov-12 5:07
mvePete O'Hanlon29-Nov-12 5:07 
GeneralRe: ACL vs SQL for fuzzy matching Pin
Ben Dessau29-Nov-12 6:43
Ben Dessau29-Nov-12 6:43 
GeneralRe: ACL vs SQL for fuzzy matching Pin
Pete O'Hanlon29-Nov-12 6:50
mvePete O'Hanlon29-Nov-12 6:50 
QuestionSQL Query Pin
berba29-Nov-12 2:22
berba29-Nov-12 2:22 
AnswerRe: SQL Query Pin
Richard Deeming29-Nov-12 2:50
mveRichard Deeming29-Nov-12 2:50 
GeneralRe: SQL Query Pin
berba2-Dec-12 18:30
berba2-Dec-12 18:30 
QuestionSQL Server windows authentication Pin
Zeyad Jalil28-Nov-12 23:49
professionalZeyad Jalil28-Nov-12 23:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.