IIF Command in SQL Server

IIF Command in SQL Server

There is no “IIF” function in SQLSERVER as of VB and Access.
For example, say you had a table like this:

 StudID	Subject		Marks------	------		------1	Maths		801	Physics		751	Chemistry	601	English		45

Use the “Case” Command in SQLServer:

 --//////////////////////////////SELECT StudID,Subject,Marks,Status =  CASE  WHEN Marks > 50 THEN "Passed"  ELSE "Failed"  ENDfrom tblMarks--//////////////////////////////StudID	Subject		Marks 		Status------	------		------		--------1	Maths		80		Passed1	Physics		75		Passed1	Chemistry	60		Passed1	English		45		Failed

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist