[dba-SQLServer] Re: Date field type

Robert L. Stewart rl_stewart at highstream.net
Thu Jul 15 14:52:23 CDT 2004


Susan,

Why not sort on the unconverted column and not include it in the result set?

Robert

At 12:12 PM 15/07/2004 -0500, you wrote:
>Date: Wed, 14 Jul 2004 14:22:10 -0500
>From: "Susan Geller" <sgeller at cce.umn.edu>
>Subject: [dba-SQLServer] Date field type
>To: <dba-SQLServer at databaseadvisors.com>
>Message-ID: <DCE82B0926109E4B986BF32CFA78495C0DCC57 at MAIL1.cce.local>
>Content-Type: text/plain;       charset="US-ASCII"
>
>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?
>
>--Susan





More information about the dba-SQLServer mailing list