Home Forums SQL Server 7,2000 General Removing the time from a datetime database field RE: Removing the time from a datetime database field

  • More than one way to skin that cat.

    for the sake of simplicity, I would use Antares686 solution. I bet it is also the one with best performance. At least compared to those which use a UDF.

    But...

    select cast(cast(getdate() as bigint) as datetime)

    select getdate()

    select dateadd(d,datediff(d,0,getdate()),0)

    select cast(cast(getdate() as bigint) as datetime)

                                                          

    ------------------------------------------------------

    2004-02-25 15:46:58.990

    (1 row(s) affected)

                                                          

    ------------------------------------------------------

    2004-02-25 00:00:00.000

    (1 row(s) affected)

                                                          

    ------------------------------------------------------

    2004-02-26 00:00:00.000

    (1 row(s) affected)

    ???

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]