Results 1 to 3 of 3

Thread: [RESOLVED] Query using Dates [mssql 2000]

  1. #1

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Resolved [RESOLVED] Query using Dates [mssql 2000]

    Hi guys good day.
    How would I eliminate the time in a datetime field.
    i.e the value in the table in a datetime field is
    2/9/2006 1:13:49 PM and I want to select data that has date 2/9/2006.

    'assuming the xdate has (2/9/2006 1:13:49 PM) value

    select * from table where xdate='2/9/2006' <---it wont work because xdate value has time and the time are included in the where clause. What I want is to select the specific date excluding the time.

    thanks in advance.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Query using Dates [mssql 2000]

    Using the Convert function is one option

    Where Convert(varchar(10), xdate ,101) = '02/09/2006'

    Style 101 = mm/dd/yyyy

  3. #3

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Query using Dates [mssql 2000]

    Quote Originally Posted by brucevde
    Using the Convert function is one option

    Where Convert(varchar(10), xdate ,101) = '02/09/2006'

    Style 101 = mm/dd/yyyy

    thanks mate! It works.

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