I am trying to return a varchar converted to date. Then I want to sort by the date. Returned values vary, some are 02/01/2004, some 2/01/2004, etc. This is causing sql to not sort the way I want. I would like to sort chronologically by year, then month, then day.
Here's my query
Here's a typical result set.
02/13/2002
1/1/1900
1/1/2000
1/10/1999
1/12/2003
1/4/1999
1/8/2003
10/14/2002
10/30/2002
10/31/2002
12/24/1998
2/26/1998
3/16/2004
8/7/2002 1:49:3
8/9/2002
9/10/1999
9/2/1998
9/22/1998
9/23/2002
9/3/1998
9/5/2003
Here's my query
Code:
Select Convert(Varchar(15), FieldValue, 101)
from data
where fieldID = 289
order by fieldvalue asc
Here's a typical result set.
02/13/2002
1/1/1900
1/1/2000
1/10/1999
1/12/2003
1/4/1999
1/8/2003
10/14/2002
10/30/2002
10/31/2002
12/24/1998
2/26/1998
3/16/2004
8/7/2002 1:49:3
8/9/2002
9/10/1999
9/2/1998
9/22/1998
9/23/2002
9/3/1998
9/5/2003