Click to See Complete Forum and Search --> : Query with SQL Server


udipr
May 1st, 2001, 08:23 AM
Hello

I have problem with Query on SQL Server DB.
I want to show field with condition, in Access I wrote it that way:

SELECT iif (condition, field1, field2), field3 FROM Table1

I try it that way but SQL Server dont recognize 'iif' function.

Is any body know how do i do it in SQL Server ? (without using Store Procedure).

Thanks for any help.

dfwade
May 1st, 2001, 08:45 AM
look at the case structure for sql server. You can include this in your select.

select case condition field1 else field2, field3 from table1
That is only the rough syntax but the case statement will do what you are looking for.

udipr
May 1st, 2001, 09:01 AM
I try it and it don't work.