in the following sql query i have a select case without else
SET dateformat mdy
DECLARE @DATE1 DATETIME
SET @DATE1 = '12/31/2011'
DECLARE @DATE2 DATETIME
SET @DATE2 = '06/01/2012'
UPDATE tablx
SET xdate = case WHEN xdate is null and odate BETWEEN @Date1 AND @Date2 then odate end
does the existance of else make difference, in the above case would the xdate value be filled with NULL if the condition is not met even if i didnt write ELSE NULL?
It doesn’t make any semantic difference
ELSE NULLis the default if omitted.Perhaps including the redundant
ELSEexplicitly might be clearer for potential readers unaware of this fact though.