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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Equivalent of MS Access IIF function in SQL?

Status
Not open for further replies.

ChrisN

Programmer
Jul 9, 2001
59
0
0
GB
Is there an equivalent to the MS Access IIF function in SQL??

TIA
Chris
 
Not in SQL 7.0 - maybe in SQL2K (though I doubt) - probably can create a UDF in SQL2K.

You can also use CASE instead

select case when <some condition> then <some value> else
<some other value> end


RT
 
I alse used IIF for handling nulls, which in SQL Server comes out like: ISNULL(MiddleName, N'(NMN)')

In this example NMN is shown if MiddleName is null.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top