Oracle NVL equivalent on MS SQL

I have been an Oracle DB person for quite a while until my new job where we are running DB2 and MS SQL for the moment. Now, in Oracle, the NVL() function is a quick shortcut for series of nasty CASE THEN ELSE statements. Since the data am dealing with here is a little messy, I needed plenty of such.To make matters worse, SQL is the only common denominator for me between Oracle and MS SQL (as far as Mr. Olowe is concerned).

Anyway, after banging my head on the table exactly 1001 times, I finally discovered that ISNULL(element_to_check,value_if_null) does the same thing. I gleefully went over my previous codes and yanked the sonafab***h CASE statements out.

Knowledge is really power.

To read more on ISNULL for MS SQL, head over to http://msdn.microsoft.com/en-us/library/ms184325.aspx

Author: dejiolowe

Adédèjì is the founder of Lendsqr, the loan infrastructure fintech powering lenders at scale. Before this, he led Trium Limited, the corporate VC of the Coronation Group, which invested in Woven Finance, Sparkle Bank, Clane, and L1ght, amongst others. He has almost two decades of banking experience, including stints as the Divisional Head of Electronic Banking at Fidelity Bank Plc. He drove the turnaround of the bank’s digital business. He was previously responsible for United Bank for Africa Group’s payment card business across 19 countries. Alongside other industry veterans, he founded Open Banking Nigeria, the nonprofit driving the development and adoption of a common API standard for the Nigerian financial industry. Beyond open APIs, Adédèjì works deeply within the fintech ecosystem; he’s the board chairman at Paystack. Adédèjì is a renowned fintech pundit and has been blogging on technology and payments at dejiolowe.com since 2001.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.