Каков аналог функции iif() SQL запросе SQL-server? (-)

Michel
Дата: 25.10.2000 10:58:18
-
Stork
Дата: 25.10.2000 13:05:38
(C) SQL Server Books Online

Syntax
Simple CASE expression:
CASE expression
WHEN expression1 THEN expression1
[[WHEN expression2 THEN expression2] [...]]
[ELSE expressionN]
END
Searched CASE expression:
CASE
WHEN Boolean_expression1 THEN expression1
[[WHEN Boolean_expression2 THEN expression2] [...]]
[ELSE expressionN]
END
Vasily
Дата: 25.10.2000 13:37:30
Ну а если поподробнее, то так

select field1, field2, (case field3 when 1 then 'Единица' when 2 then 'Двойка' else 'Много' end) as field_number

или

select field1, field2, field_number = case field3 when 1 then 'Единица' when 2 then 'Двойка' else 'Много' end

или

select field1, field2, field_number = case field3 = 1 then 'Единица' else 'Много' end
Michel
Дата: 25.10.2000 13:56:44
-