Results 1 to 2 of 2

Thread: Date only? [Resolved]

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Date only? [Resolved]

    Hi.

    in SQL, I have made a table which has a datetime field. This field will only store the DATE, not including time.

    Now, since there is an entry of a given date, say 16/04/2006. If I execute a query to get me a record which has the date of 16/04/2006 it will not return it, as the datetime also includes time - which would be 00.00.000 and so on.

    how can I just do a search based on the date given only and forget the time altogether?

    I have also just tried smalldatetime but i still get no results
    Last edited by Techno; Apr 10th, 2006 at 10:51 PM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Date only?

    Sorted:

    parameter should be:

    'year/month/day'

    ie:

    DECLARE @theDate smalldatetime
    SET @theDate = '2006/04/16'

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

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



Click Here to Expand Forum to Full Width