sql server - Calculating the difference bwteen dates in a specificed date range -
i'm trying calculate days between 2 dates rows faly within 2 dates only.
essentially if record falls in financial year '2012-11-01 00:00' , '2013-10-31 23:59' want know how many nights there between b.depart , end of year, ie '2013-10-31 23:59'.
the error is:
conversion failed when converting varchar value 'null' data type int.
this have got to:
case when b.depart between '2012-11-01 00:00' , '2013-10-31 23:59' datediff (minute, b.depart, '2013-10-31 23:59') else 'null' end '2012/13 nights'
help appreciated!
case when b.depart between '2012-11-01 00:00' , '2013-10-31 23:59' datediff (minute, b.depart, '2013-10-31 23:59') else null end '2012/13 nights'
instead of 'null' treated varchar, go null.
Comments
Post a Comment