Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i use a Cond "IIF" in SQLServer?

Status
Not open for further replies.

JCooL

Programmer
Oct 21, 2001
89
US
Hi,

I want to know how can I use this Condiction in SQLServer 2000, look..

iif (table.day < 30,Amount,0)

if Day < 30 then show Amount where all records have the
Day < 30 else show 0

 
This would probably get answered in an SQL Server forum. Terry M. Hoey
 
The SQL for Sql server 2000 has a case statement. Here is an example from the Sql server help.
SELECT 'Price Category' =
CASE
WHEN price IS NULL THEN 'Not yet priced'
WHEN price < 10 THEN 'Very Reasonable Title'
WHEN price >= 10 and price < 20 THEN 'Coffee Table Title'
ELSE 'Expensive book!'
END,
CAST(title AS varchar(20)) AS 'Shortened Title'
FROM titles
ORDER BY price

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top