?
Solved

Capturing the Hour from a Date Time field

Posted on 2006-04-12
2
Medium Priority
?
294 Views
Last Modified: 2008-02-20
I have a field that is currently filled with a date and time - 'action_time'

I want the query to return the hour from this time so I can group by this.  I would also like it to be returned as a 24 Hr hour.

Let me know if any more info is needed.

Scotto13
0
Comment
Question by:Scotto13
2 Comments
 
LVL 2

Accepted Solution

by:
knucklesbamm earned 1000 total points
ID: 16439840
select datepart(hh, datecol)
  from dbo.table
0
 

Author Comment

by:Scotto13
ID: 16439858
Awesome!

Thanks knuckles
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question