SQL Server 2005 Date Time stamp Query

One of my columns type is DateTime (Date Registered). I cannot create a query that filters all the data for eg. All registrations who registered on the 22/10/2008 between 18:00 and 20:00.

Thanks

This question and answers originated from www.stackoverflow.com
Question by (12/10/2008 7:20:14 PM)

Answer

SELECT *
FROM YourTable
WHERE DateRegistered BETWEEN '10/22/2008 18:00:00' AND '10/22/2008 20:00:00'

Should do the trick

Answer by

Find More Answers
Related Topics  sql-server  query  datetime
Related Questions
  • High precision date/time stamp in SQL Server 2005

    I have bulk records that are getting imported into a SQL Server 2005 table. I need to be able to maintain the same order that they were imported. I was using a DateTime field and populating it to GE…
  • Ignoring Time stamp for a count in SQL Server 2005

    I am having an issue figuring out what I thought would be a simple query. I have a table with two fields (EntryDateTime, Message) that as you can guess logs specific messages with a time date stamp …
  • SQL Server default date time stamp?

    I have a field that when something is inserted I want it to get the current Date & Time and insert this into the database. Is there a way to get the date & time, and set it as the default va…
  • Query by Date/Time in SQL Server 2005

    I have such a simple question, I feel stupid for asking it. I can't believe I'm hitting my head on this. I have a table called "Orders". "Orders" has a smalldatetime field called "DateOrdered". I…
  • SQL server 2005 - query aribitrary time interval in date range

    I have a DateTime column. I want to extract all records, lets say, from 8:30 to 16:15 within a certain date range. My problem is that I need to compare hour and minute as a single time value. I can …
  • Date & time query question (SQL Server 2008)

    I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45 4|01/04/2004|12:55 I need to know the difference between the MAX…
  • Selecting date value without time in SQL Server 2005

    I am facing a problem selecting the date in SQL Server 2005. The table name is Softskill and the column name is insertdate. The data is stored as 2011-09-22 08:50:28.000 in this format. To select…
  • Specific Time Range Query in SQL Server

    I'm trying to query a specific range of time: i.e. 3/1/2009 - 3/31/2009 between 6AM-10PM each day Tues/Wed/Thurs only I've seen that you can get data for a particular range, but only f…
  • Date Time in SQL Server 2005

    I have a datetime column in table that has time component. Is there anyway I can set '2011-03-14 11:46:31' to '2011-03-14 00:00:00'?
  • SQL Server updating a time stamp column

    In my database I have a timestamp column. I need to update a row in the table and need to update the timestamp column. When I run an update command I get: Cannot update a timestamp column. Ho…