トップページに戻る    次のSQLServerのサンプルへ

1-1 条件分岐な関数


select IsNull(null,3) as "IsNull関数1",
IsNull(1,3) as "IsNull関数2",
coalesce(null,2) as "coalesce関数1",
coalesce(1,2) as "coalesce関数2",
case 1 when 1 then 'a' else 'b' end as "単純case式",
case when 1=1 then 'c' else 'd' end as "検索case式"
go

IsNull関数1  IsNull関数2  coalesce関数1   coalesce関数2  単純case式  検索case式
-----------  -----------  -------------  -------------  ----------  ----------
          3            1              2              1  a           c

MSDN --- IsNull関数
MSDN --- coalesce関数
MSDN --- case式