Getting a Date from DateTime

  • haha!  So true....  However i wonder if they designed TSQL from many different directions and it didnt line up when they met in the middle....

  • We use

    DATEADD(d,DATEDIFF(d,0,T.ApptDate),0) to get the date with time set to midnight.  We have found that CAST and CONVERT are way too slow when applied to large subsets of data.

    Terri



    Terri

    To speak algebraically, Mr. M. is execrable, but Mr. C. is
    (x+1)-ecrable.
    Edgar Allan Poe
    [Discussing fellow writers Cornelius Mathews and William Ellery Channing.]

  • did you try cast to float/int?

    Casting to strings, calling convert would be slow. 

    I bet CAST(CAST(SomeDate AS FLOAT) AS INT) is faster than using DateAdd...

    - John

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply