SQL ISNULL,sqlisnull

來源:互聯網
上載者:User

SQL ISNULL,sqlisnull

使用指定的值替換 NULL
ISNULL用來判斷當所選列是空值的時候你打算用什麼值去替換

ISNULL ( check_expression , replacement_value )
SELECT CASE WHEN m.[辦結日期] IS NULL THEN 1900     ELSE YEAR(m.[辦結日期]) END AS 合作結算明細_辦結年份,ISNULL(m.[付款金額], 0)  合作結算明細_付款金額,ISNULL(m.[實際支付],  0) 合作結算明細_實際支付,m.[單項編號],m.[部門] as 合作結算明細_部門, ISNULL(m.[實際支付],  0) - ISNULL(m.[付款金額], 0) 合作結算明細_還需支付FROM [BI_合作結算明細_FOR_ANALYSE] as m

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.