Calculated column using date column
Posted: Thu Oct 27, 2011 4:40 pm
I have a date column "dt" that can accept nulls. I want to create a calculated bool column that returns true if the date is less than today, or false otherwise.
The formula is:
(MyTable.dt < DateTime.Now)?true:false
This almost works ... but of the date value is a NULL, then the formula returns a null as well. What is the easiest way to write a formula for this ... I could manually check for a null but that makes the formula really complex:
(IsNull(MyTable,"dt2))?true:((MyTable.dt < DateTime.Now)?true:false)
The formula is:
(MyTable.dt < DateTime.Now)?true:false
This almost works ... but of the date value is a NULL, then the formula returns a null as well. What is the easiest way to write a formula for this ... I could manually check for a null but that makes the formula really complex:
(IsNull(MyTable,"dt2))?true:((MyTable.dt < DateTime.Now)?true:false)