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
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement