Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    4

    Unanswered: how to get current date with no time

    can any one help me to get only date from getdate()
    I have used datepart etc but getting syntax error.

    Thanks in advance

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    SELECT DATEADD(d,DATEDIFF(d,0,GETDATE()),0) AS today
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by r937 View Post
    SELECT DATEADD(d,DATEDIFF(d,0,GETDATE()),0) AS today
    It's about time Microsoft supports CURRENT_DATE to make such monsters redundant...

  4. #4
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Quote Originally Posted by shammat View Post
    It's about time Microsoft supports CURRENT_DATE to make such monsters redundant...
    I second that!
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •