﻿<?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 / SQL Server Newbies  / Check Datetime Existence within multiple columns / 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>Sat, 25 May 2013 15:35:24 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Check Datetime Existence within multiple columns</title><link>http://www.sqlservercentral.com/Forums/Topic1410489-1292-1.aspx</link><description>You cannot mark them as answered on SSC, as it is primarily a discussion forum so topics are open for all to see and people may come back with their own take on how to solve your problem.</description><pubDate>Wed, 23 Jan 2013 06:00:19 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Check Datetime Existence within multiple columns</title><link>http://www.sqlservercentral.com/Forums/Topic1410489-1292-1.aspx</link><description>Thank you so much Tunnel.I've tried it and its working fine.How can I mark your post as an answer?</description><pubDate>Wed, 23 Jan 2013 05:58:24 GMT</pubDate><dc:creator>adnan8t2</dc:creator></item><item><title>RE: Check Datetime Existence within multiple columns</title><link>http://www.sqlservercentral.com/Forums/Topic1410489-1292-1.aspx</link><description>Please take a moment to read through the second link in my signature on posting code and data for the best help.But based on your post, you need something like this[cod="sql"]DECLARE @Bill TABLE (BillDate DATETIME, Mark BIT)INSERT INTO @Bill VALUES('2012-11-10 11:15:30',0),('2012-12-12 09:00:00',0)DECLARE @Dates TABLE (FromDate DATETIME, ToDate DATETIME)INSERT INTO @Dates VALUES('2012-11-01 07:00:00','2012-11-09 23:59:59'),('2012-12-08 07:00:00','2012-12-15 23:59:59')UPDATE	BSET	Mark = 1FROM	@Bill BINNER JOIN	@Dates d 	ON	b.BillDate &amp;gt;= d.FromDate 	AND	b.BillDate &amp;lt;= d.ToDateSELECT * FROM @Bill[/code]</description><pubDate>Wed, 23 Jan 2013 05:48:38 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Check Datetime Existence within multiple columns</title><link>http://www.sqlservercentral.com/Forums/Topic1410489-1292-1.aspx</link><description>Hi there,I've a BillDate as date, and a Mark as bit column in First table.(Mark=0 by default)In Second table I've FromDate as date, and ToDate as date Column.I want to set Mark=1 if BillDate is exists between FromDate &amp; ToDateLet Say In First Table the data is----------------------------BillDate                     | Mark----------------------------2012-11-10 11:15:30  | 02012-12-12 09:00:00  | 0In Second Table the data is---------------------------------------------FromDate                  | ToDate---------------------------------------------2012-11-01 07:00:00  | 2012-11-09 23:59:592012-12-08 07:00:00  | 2012-12-15 23:59:59So in the above scenario only the second row from First tablewhich is having, BillDate-&amp;gt;2012-12-12 09:00:00 will be Mark as 1because it comes between second row of second tableI hope I've explained my scenario,</description><pubDate>Wed, 23 Jan 2013 05:05:24 GMT</pubDate><dc:creator>adnan8t2</dc:creator></item></channel></rss>