sql server - Returning any of multiple CASE statements in one column -


unless case statements here true returns null entire options column. cannot figure out how return true case statments, ie: if col2,col4 not null return values. have no idea else try, help?

select  case when col1 not null '<li>' + col1 + '</li>' end + case when col2 not null '<li>' + col2 + '</li>' end + case when col3 not null '<li>' + col3 + '</li>' end + case when col4 not null '<li>' + col4 + '</li>' end options table 

again, issue unless case statements found, returns null options column.

like this:

select  case when col1 not null '<li>' + col1 + '</li>' else '' end + case when col2 not null '<li>' + col2 + '</li>' else '' end + case when col3 not null '<li>' + col3 + '</li>' else '' end + case when col4 not null '<li>' + col4 + '</li>' else '' end options table 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -