View Full Version : IIf in view


Pauldohert
02-02-2006, 01:14 AM
How do I put a derived field into a view iN SQL Server

In access I would have

IIf([field1] = True,"",[Field2])

Or Alertantively can I return a Null instaed of the zero length string.

IIf([field1] = True,Null,[Field2])

Thanks

Pauldohert
02-02-2006, 02:09 AM
For this particular example I can get way with


LEFT(Field2, LEN(Field2) * ~ Field1) AS Expr1


But only because field1 is yes,no

Kodo
02-02-2006, 03:40 AM
for the null replacement you can do

ISNULL(FieldName,ReplacementValue)