Replacing NULL with 0 in a SQL server query

后端 未结 12 1201
情书的邮戳
情书的邮戳 2020-11-28 02:39

I have developed a query, and in the results for the first three columns I get NULL. How can I replace it with 0?

  Select c.rund         


        
12条回答
  •  粉色の甜心
    2020-11-28 03:16

    When you want to replace a possibly null column with something else, use IsNull.

    SELECT ISNULL(myColumn, 0 ) FROM myTable
    

    This will put a 0 in myColumn if it is null in the first place.

提交回复
热议问题