Re: How can I select rows where the time is midnight

From: Harman (harmand_at_grapecity.com)
Date: 02/28/05


Date: Mon, 28 Feb 2005 12:39:05 +0530

Hi,

You can use a query like this:

select * from gemployee where
datepart(dd,dob-'00:00:01') < datepart(dd,dob)

Here the dob column is a datetime column. The above query would select all
the employees whose date of birth is set
to midnight.

Hope it helps.

Regards,
Harman

"Royboy" <Royboy@discussions.microsoft.com> wrote in message
news:9CF14B36-8EFC-4753-9F7C-752AB64F6D46@microsoft.com...
> I have a datetime field in a table. I want to extract a list of distinct
> dates where the time is set to midnight.
>
> In DB2 I could have something like
>
> Select DISTINCT TABLEA.FIELDDATE From TABLEA
> Where Time(TABLEA.FIELDDATE) <> '00.00.00'
>
> I have looked through the online books but I cannot find an equivalent
> function to Time. I tried the CAST function but there does not seem to a
Time
> style. The DateName would mean having 3 different clauses in the where
> statement. There are typically over a million rows in the table but
usually
> less than 5 million.
>
> How can I do the same in SQL SERVER?
>
> Thanks
>
>



Relevant Pages

  • Re: Database query performance
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... Indexing of DateTime column does not ... >> To see how the server is handling the query, you can turn on the query ... >> Please reply only to the newsgroup so that others can benefit. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Pass-Through Queries
    ... if you are using Pass-Through Queries - there is nothing to do with linked ... The table has a datetime column from ... > having a bogus date in them when pulled via an Access query. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Subtract datetime value from the datetive value in previous re
    ... Currently she is copying query data into ... zero but after that the value of each cell is the value of a datetime column ... this may have to be done with a recordset using VBA but i wanted to see if ... This should give the number of days between the value of datefield in the ...
    (microsoft.public.access.queries)
  • Pass-Through Queries
    ... The table has a datetime column from ... having a bogus date in them when pulled via an Access query. ... choice is a pass-through query which just calls a view created in SQLServer. ... SQLServer tool but when using Access, the dates are bogus. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Pass-Through Queries
    ... Well darned if refreshing via the Link Manager doesn't work every time! ... >> query a table of data in SQLServer. ... The table has a datetime column from ... >> having a bogus date in them when pulled via an Access query. ...
    (microsoft.public.access.modulesdaovba)