Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Check Datetime Existence within multiple columns Expand / Collapse
Author
Message
Posted Wednesday, January 23, 2013 5:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, January 23, 2013 5:55 AM
Points: 9, Visits: 9
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 & ToDate

Let Say In First Table the data is
----------------------------
BillDate | Mark
----------------------------
2012-11-10 11:15:30 | 0
2012-12-12 09:00:00 | 0

In Second Table the data is
---------------------------------------------
FromDate | ToDate
---------------------------------------------
2012-11-01 07:00:00 | 2012-11-09 23:59:59
2012-12-08 07:00:00 | 2012-12-15 23:59:59

So in the above scenario only the second row from First table
which is having, BillDate->2012-12-12 09:00:00 will be Mark as 1
because it comes between second row of second table

I hope I've explained my scenario,
Post #1410493
Posted Wednesday, January 23, 2013 5:20 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 2:36 AM
Points: 2,840, Visits: 3,970
Dont cross post.. it wastes time of other people.

Original post here http://www.sqlservercentral.com/Forums/Topic1410489-1292-1.aspx


-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1410497
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse