Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Order By Date

Author  Topic 

breakoutfoo
Starting Member

1 Post

Posted - 2010-03-01 : 15:34:48
Hi,

I have a table of data that updates over time as users add to it. Data is ordered by the date of entry.

This worked well all through february (it started being populated on the 5th feb) until today when all entries made (today) were put as the first entry in my table - obviously because my SQL ordering is dealing with my stored dates in the US format rather than the desired UK format - 01/03/2010 coming before 05/02/2010 in the US way of working.

How can I get around this either by altering my SQL or configuring my database?

Thanks

Andy

Andy

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-03-01 : 18:05:09
Just to clarify, there is no order unless you specify an ORDER BY clause.. So, given that, are you having other issues?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-02 : 08:57:11
I guess you may be using varchar fields to store date values or converting them to varchars before doing sorting which may be why your dont get correct date sorting. make sure you keep date values as datetime type and they will sort fine. you can do formatting stuff at your front end using format functions so no need of altering datatype for that

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -