SQL 學習筆記

目錄

NULLIF、ISNULL、IFNULL

NULLIF

Returns a null value if the two specified expressions are equal. (MSDN)

Syntax:

NULLIF ( expression , expression )

Example:

SELECT NULLIF(id, '') FROM table

Result:
id若為空(''),則會呈現 NULL 型態

ISNULL

Replaces NULL with the specified replacement value. (MSDN)

Syntax:

ISNULL( check_expression , replacement_value )

Example:

SELECT ISNULL(id, '0') FROM table

Result:
id若為NULL,則會呈現0

sql.txt · 上一次變更: 2011/06/23 03:25 由 achi
 
若未特別註明,此維基上的內容都是採用以下授權方式: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki