I'm sure this is a simple question, but I'm a bit stumped. We have an application that runs on both Oracle 9i, and MSSQL Server 2000 (it's a distributed application). We're running into an interesting issue where we are sorting by a date column that may or may not contain NULL values. The column is EVENT_DATE, which represents an event date for a simple announcements application, which is entirely optional.
When we use the following query:
SELECT * FROM OUR_SCHEMA.TBL_ANNOUNCEMENTS ORDER BY EVENT_DATE ASC
We get an ordering on Oracle where dates come before NULLs, and where NULLs come before dates in MSSQL Server, such as:
Annc 1 10/10/2005
Annc 2 10/10/2006
Annc 3 10/10/2007
Annc 4 NULL
Annc 5 NULL
Annc 1 NULL
Annc 2 NULL
Annc 3 10/10/2005
Annc 4 10/10/2006
Annc 5 10/10/2007
Any ideas on why this is happening and perhaps how to work around it? We would ideally like to have dates come before NULLs when using ASC .