The closest you're going to come is the case or coalesce statement depending
on needs.
select cola
, case
when colb = 1
then 'one'
when colb = 2
and cola = 1
then 'twelve'
else 'huh?'
end as case1
, coalesce (colc, cold, cole, 'default') coalese1
from tab
;
CASE can be nested as in
CASE
when CASE
when
else
END
else
END
If there's no need to check for null you can code case as
CASE col
when 1 then 'one'
when 2 then 'two'
else 'huh?'
END
With CASE, the first condition that is true causes the value associate with
the 'then' clause to be returned. If no when condition is matched, then the
value specified by the else clause is returned. If no else clause is
specified then a null is returned.
COALESCE is a special version of the CASE statement. It simply returns the
first non-null value.
--
Walter Clayton
Any technology distinguishable from magic is insufficiently advanced.
[quoted text, click to view] "Vincent" <vincent@exodus-tech.com> wrote in message
news:OTsnSxTHFHA.3156@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> Recently, i convert the database from access 2000 to mssql 2000. After
> that, i find access sql function ' iif( , , ) ' can not be run on mssql
> 2000. So, my question is that any function can replace 'iif' in mssql
> 2000? Please give an example. Remark: If.. then..else can not be used in
> view in mssql 2000.
Hi,
Recently, i convert the database from access 2000 to mssql 2000. After
that, i find access sql function ' iif( , , ) ' can not be run on mssql
2000. So, my question is that any function can replace 'iif' in mssql
2000? Please give an example. Remark: If.. then..else can not be used in