sql server - SQL - Choose which field to select -


ok, title may bit strange, i'm trying doesn't seem quite complicated.

i have table mytable 2 fields defaultname , customname. make query selects customname if it's not null neither empty, otherwize defaultname not blank.

i'd grateful or link related post.

sql server syntax:

  select case            when customname not null , customname <> ''               customname            else               defaultname          end customername     mytable 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -