SqlServerTimeZoneSupport
SqlServerTimeZoneSupport copied to clipboard
Handle NULL option as default
If NULL is supplied to the @FirstOnFallBackOverlap parameter then the function uses the non-default action instead of the default. For this reason I have added a check for NULL. It is okay for the @SkipOnSpringForwardGap case as there is a test against 0 that requires it to be explicitly set for non-default behaviour.
In what case might a NULL be passed explicitly? I see what this is guarding against, but I'm not sure it would actually be encountered.
What I'd really like is a way to not have to pass a value at all, but I don't think this can be accomplished with functions.
The usual pattern would be calling with DEFAULT explicitly, but since T-SQL inline variables all all nullable types there's the potential for unintended behaviour. I think many would like properly optional arguments. I see NULL/DEFAULT as similar, with both leaving it to the function to decide the behaviour. It's not so easy on the calling side to dynamically control the value between 0, 1 and DEFAULT without using a NULL-supporting ternary state.