Question : How to enter a derived column in a SQL Server query being built using Access that provides if/then/else functionality

I need to enter an expression for a derived field in a view. The view is being defined using Access 2002 connected to a SQL Server database. I want to test a numeric value and, if greater than 0, set the column value to 'Yes', otherwise set it to 'No'.

I have tried various verions of 'if' and 'iif' and I keep getting errors.

Kevin

Answer : How to enter a derived column in a SQL Server query being built using Access that provides if/then/else functionality

in the view you can use the Case When function

Simple CASE function:

CASE WHEN yourfield >0 THEN 'Yes'
   ELSE 'No'
END

Alan



Random Solutions  
 
programming4us programming4us