[dba-SQLServer] Date field type

Ken Stoker kens.programming at verizon.net
Wed Jul 14 14:49:33 CDT 2004


Susan,

Someone on here once gave me this option (sorry I don't remember who it was,
but he/she was someone smarter than me).

	CONVERT(datetime, FLOOR(CONVERT(REAL, YourDate)))

Hope this helps.

Ken

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan
Geller
Sent: Wednesday, July 14, 2004 12:22 PM
To: dba-SQLServer at databaseadvisors.com
Subject: [dba-SQLServer] Date field type

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


Susan B. Geller
Office of Information Systems
College of Continuing Education
University of Minnesota
306 Wesbrook Hall
77 Pleasant Street SE
Minneapolis, MN 55455
Phone:  612-626-4785
Fax:  612-625-2568


_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list