Re: How can I select rows where the time is midnight
From: Harman (harmand_at_grapecity.com)
Date: 02/28/05
- Next message: mark baekdal: "RE: DataBase reusability"
- Previous message: Sa: "Re: writing audit trail for a table"
- In reply to: Royboy: "How can I select rows where the time is midnight"
- Messages sorted by: [ date ] [ thread ]
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
>
>
- Next message: mark baekdal: "RE: DataBase reusability"
- Previous message: Sa: "Re: writing audit trail for a table"
- In reply to: Royboy: "How can I select rows where the time is midnight"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|