Skip to content
Advertisement

Formatting column in SQL

I would like to insert the pipe character | in a column to separate two sections of the output. Is there a way to put one in every row of a column as long as there is data in that row?

Advertisement

Answer

select   column1, 
         column2,
         case 
           when column3 is not null 
           then '|' 
           else '' 
         end
from your_table