|
Posted by Paul Lautman on 01/21/07 16:40
Dale wrote:
> Well Paul, I did try that and here's the message that comes back...
>
> Server: Msg 195, Level 15, State 10, Line 1
> 'Hour' is not a recognized function name.
>
>
> "Paul Lautman" <paul.lautman@btinternet.com> wrote in message
> news:51h5q7F1ipb3iU1@mid.individual.net...
>> Dale wrote:
>>> A table has a field containing the date and time. Example 2006-2-20
>>> 08:11:44.123...field name is DateInitiated. I can extract the month,
>>> day and year by using Day(DateInitiated), Month(DateInitiated),
>>> Year(DateInitiated). How would the time be extracted for hours,
>>> minutes and seconds?
>>> Thanks!
>>
>> Would you believe HOUR() MINUTE() SECOND, or is that too obvious!
I missed the other newsgroups in the title, you are obviously using
Microsoft SQL Server which, unlike DB/2 and MySQL does not have these other
useful functions.
You need the datepart function.
See http://msdn2.microsoft.com/en-us/library/aa258265(SQL.80).aspx
Navigation:
[Reply to this message]
|