sql - trying to update a column with difference between 2 dates when one can be NULL -
with following code:
update factquote set conversiondays = case when conversiondate = null null else datediff(day, initialcontactdate, conversiondate) end
keep getting message:
msg 206, level 16, state 2, line 10 operand type clash: int incompatible date
how can fix this?
this not answer, simplification (which long comment).
datediff()
-- many other functions -- returns null
when either date argument null
. so, can simplify expression to:
update factquote set conversiondays = datediff(day, initialcontactdate, conversiondate);
Comments
Post a Comment