W3Schools.com (2024)

Example

Return "YES" if the condition is TRUE, or "NO" if the condition is FALSE:

SELECT IIF(500<1000, 'YES', 'NO');

Try it Yourself »

Definition and Usage

The IIF() function returns a value if a condition is TRUE, or another value if a condition is FALSE.

Syntax

IIF(condition, value_if_true, value_if_false)

Parameter Values

Parameter Description
condition Required. The value to test
value_if_true Optional. The value to return if condition is TRUE
value_if_false Optional. The value to return if condition is FALSE

Technical Details

Works in: SQL Server (starting with 2012), Azure SQL Database

More Examples

Example

Return 5 if the condition is TRUE, or 10 if the condition is FALSE:

SELECT IIF(500<1000, 5, 10);

Try it Yourself »

Example

Test whether two strings are the same and return "YES" if they are, or "NO" if not:

SELECT IIF('hello' = 'bye', 'YES', 'NO');

Try it Yourself »

Example

Return "MORE" if the condition is TRUE, or "LESS" if the condition is FALSE:

SELECT OrderID, Quantity, IIF(Quantity>10, 'MORE', 'LESS')
FROM OrderDetails;

Try it Yourself »


W3schools Pathfinder

Track your progress - it's free!

W3Schools.com (2024)
Top Articles
What are the implications and impacts of overpopulation?
How to Make an Income as a Mom Influencer
This website is unavailable in your location. – WSB-TV Channel 2 - Atlanta
Coverage of the introduction of the Water (Special Measures) Bill
Booknet.com Contract Marriage 2
Craigslist Portales
Cinepacks.store
Truist Drive Through Hours
Umn Biology
Danielle Longet
Craigslist/Phx
4302024447
Colts seventh rotation of thin secondary raises concerns on roster evaluation
Raleigh Craigs List
Theresa Alone Gofundme
Simplify: r^4+r^3-7r^2-r+6=0 Tiger Algebra Solver
Diamond Piers Menards
Milanka Kudel Telegram
Best Mechanics Near You - Brake Masters Auto Repair Shops
How your diet could help combat climate change in 2019 | CNN
Morristown Daily Record Obituary
Cincinnati Adult Search
Is Windbound Multiplayer
Babbychula
yuba-sutter apartments / housing for rent - craigslist
Atlases, Cartography, Asia (Collection Dr. Dupuis), Arch…
Regina Perrow
14 Top-Rated Attractions & Things to Do in Medford, OR
Milwaukee Nickname Crossword Clue
John Deere 44 Snowblower Parts Manual
Bend Missed Connections
Ordensfrau: Der Tod ist die Geburt in ein Leben bei Gott
Kids and Adult Dinosaur Costume
Cruise Ships Archives
Iban's staff
Retire Early Wsbtv.com Free Book
Mta Bus Forums
Rs3 Bis Perks
Craigslist Florida Trucks
Express Employment Sign In
How Many Dogs Can You Have in Idaho | GetJerry.com
Craigs List Hartford
Cuckold Gonewildaudio
Deepwoken: How To Unlock All Fighting Styles Guide - Item Level Gaming
boston furniture "patio" - craigslist
Pathfinder Wrath Of The Righteous Tiefling Traitor
Craigslist St Helens
Doe mee met ons loyaliteitsprogramma | Victoria Club
60 Second Burger Run Unblocked
Wwba Baseball
Ret Paladin Phase 2 Bis Wotlk
OSF OnCall Urgent Care treats minor illnesses and injuries
Latest Posts
Article information

Author: Edmund Hettinger DC

Last Updated:

Views: 6170

Rating: 4.8 / 5 (58 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.