Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL-Server Syntax
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00168271
Message ID:
00168289
Views:
28
>>This may sound simple but it isn't for me... Am i missing something or is it just not allowed... I would like to issue a command similar to the following from VFP into SQL-Server
>>
>>select iif( DollarSales < 5000, "low", "hi" ) as saleslvl
>> from Sales
>>
>>In SQL, I know it doesn't support the IIF() but what alternatives do I have. I know it doesn't support logical fields as TRUE or FALSE in expressions, they must all be based on a numerical differential...
>>
>>Any input would be greatly appreciated...
>>
>>TIA
>
>You should use CASE statement within SELECT:
>Select 'SalesLvl'=CASE When DollarSale<5000 Then 'low' Else 'hi' END From ....

Great!!!
Thank you... I didn't know you could put the equation at each WHEN level... I thought it was more like C where you did a primary equation, then handled each possible result after...
Previous
Reply
Map
View

Click here to load this message in the networking platform