2

I have a table with 3 columns (A,B,C).

In each row, only one of the columns is not null.

How do I create a function column or a computed column that will consist from all the non null values?

Something like: column(A or B or C)

2

The syntax for virtual columns is very simple:

ALTER TABLE tableX
  ADD abc AS (COALESCE(a, b, c)) ;

Tested at rextester.com.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.