Is there a function to return the first nonempty value from a list of values ?
Here is an example of a sql statement
SELECT CASE
WHEN ISNULL(ColumnA,'') <> '' THEN ColumnA
WHEN ISNULL(ColumnB,'') <> '' THEN ColumnB
WHEN ISNULL(ColumnC,'') <> '' THEN ColumnC
WHEN ISNULL(ColumnD,'') <> '' THEN ColumnD
END .....
Is there a function that returns the first nonempty column from (ColumnA, ColumnB, ColumnC, ColumnD) ? The number of columns to be checked will not be constant.
And the sql statement that I have is much more complex than this example.