[dba-SQLServer] Date field type

Stuart McLachlan stuart at lexacorp.com.pg
Wed Jul 14 17:07:52 CDT 2004


On 14 Jul 2004 at 14:22, Susan Geller wrote:

> In my sql server 2000 table, I have a date field.  When I display that
> field in a query it displays as yyyy-mm-dd and then a timestamp.  I want
> dd/mm/yyyy and no time.  I converted it using this syntax
> convert(varchar, milestone_dt, 101)  and I get what I want, EXCEPT, when
> I try to sort by that field, it sorts as a varchar, not as a date, so I
> have all my January's together instead of all my 2004's together.  Can I
> have this format and still keep it as a date field so it will sort
> correctly?  
> 

What sort of a query?  If it's an Access query, draw the field as a date from 
the table  and set the Format property of the field in the query design grid.

If you don't need to sort dynamically,  select the converted date but sort on 
the actual date field.



 
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System Support.






More information about the dba-SQLServer mailing list