﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / event is occurring between today at 1:00am and tomorrow at 12:59am / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 03:13:32 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: event is occurring between today at 1:00am and tomorrow at 12:59am</title><link>http://www.sqlservercentral.com/Forums/Topic1432927-392-1.aspx</link><description>Just to annoy you Lynn :-D[code="sql"]select ...from mytable mtinner join (	select dateadd(hh, 1, dateadd(dd, datediff(dd, 0, getdate()), 0)) StartDate 	) DT ON mt.someeventdatetime &amp;gt;= DT.StartDate and mt.someeventdatetime &amp;lt; dateadd(dd, 1, DT.StartDate);[/code]I guess it's your turn now.:hehe:On a serious note, it could be useful to add a computed column to the table:[code="sql"]DATEADD(dd, DATEDIFF(dd, 0, DATEADD(hh, -1, someeventdatetime )), 0) RegistryDate[/code]or, if it's not an option, create a view like this:[code="sql"]select DATEADD(dd, DATEDIFF(dd, 0, DATEADD(hh, -1, someeventdatetime )), 0) RegistryDate	, *from mytable mt[/code]It will indicate which day any registered event belongs to. </description><pubDate>Tue, 19 Mar 2013 17:37:29 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>RE: event is occurring between today at 1:00am and tomorrow at 12:59am</title><link>http://www.sqlservercentral.com/Forums/Topic1432927-392-1.aspx</link><description>Something like this, just off the top of my head:[code="sql"]declare @StartDate datetime,           @EndDate datetime;select    @StartDate = dateadd(hh, 1,dateadd(dd, datediff(dd, 0, getdate()), 0)),    @EndDate = dateadd(dd, 1, @StartDate);select ...from mytable mtwhere mt.someeventdatetime &amp;gt;= @StartDate and mt.someeventdatetime &amp;lt; @EndDate;[/code]</description><pubDate>Tue, 19 Mar 2013 16:16:42 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>event is occurring between today at 1:00am and tomorrow at 12:59am</title><link>http://www.sqlservercentral.com/Forums/Topic1432927-392-1.aspx</link><description>Hello,I need a query that finds event is occurring between today at 1:00 am and tomorrow at 12:59 am. I have 2 columns.event_date datatype =date and event_time datatype= timeThis query gives me,SELECT CONVERT(datetime, CONVERT(varchar, DATEADD(day, 0, GETDATE()), 102))--2013-03-19 00:00:00.000 but instead of 0.00 I need my time whihc is 1:00 AM and 12:59 AM of next day.</description><pubDate>Tue, 19 Mar 2013 15:57:14 GMT</pubDate><dc:creator>dallas13</dc:creator></item></channel></rss>