如果列使用大小写为null,我如何查询和显示文本 [英] How can i query and display text if the column is null using case

查看:74
本文介绍了如果列使用大小写为null,我如何查询和显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Goodafternoon的家伙,



如果使用大小写特定列中的数据为空,我如何查询和(显示或更改)它? />




谢谢,任何建议和意见,将非常感谢!。

Goodafternoon guys,

How can i query and (display or change) it into a dash if the data in the specific column is null using case?


Thank You, any suggestions and opinion, will be so much appreciated!.

推荐答案

您好,



您可以使用SQL的 ISNULL 函数。它将用您的自定义文本或值(基于数据类型)替换DBNull值。

Hi,

you can make use of ISNULL function of SQL. which will replace the DBNull value with your custom text or value (based on the datatype).
--Example.
SELECT ISNULL(ColumnName, 'Your Text') AS 'Value' FROM TabelName



你可以参考 ISNULL [ ^ ]了解更多信息。



希望它帮助


you can refer ISNULL[^] for more information.

hope it helps


尝试这个



Try this one

SELECT p.ProductId,
                   p.ProductName,
                   CASE
                        WHEN p.[Description] IS NULL THEN ''-''
                        ELSE p.[Description]
                   END AS ''Description''
            FROM   Products p


这篇关于如果列使用大小写为null,我如何查询和显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆