In SQL Server, the equivalent of Oracle's NVL function is the ISNULL function.
-
Oracle
NVL(expr1, expr2): This function returnsexpr2ifexpr1isNULL; otherwise, it returnsexpr1. -
SQL Server
ISNULL(expr1, expr2): This function works similarly. It returnsexpr2ifexpr1isNULL; otherwise, it returnsexpr1.
Example
Oracle:
SELECT NVL(column_name, 'Default Value') FROM table_name;
SQL Server:
SELECT ISNULL(column_name, 'Default Value') FROM table_name;
Both expressions would replace NULL values in the column_name with 'Default Value'.
No comments:
Post a Comment