Is it possible to implement user-defined function in SQL Server that has parameter expression and return type is same as expression?
Similar to https://learn.microsoft.com/en-us/sql/t-sql/language-elements/nullif-transact-sql.
Basically, I'm looking to implement extended version of NULLIF function.
sql_variant, but otherwise I don't think you can have dynamic typing.sql_variantoften doesn't really help as you need to cast it to the base type if you want to perform any further operations on it.