将Date字段中的Null转换为String [英] Convert Null in Date field to String

查看:141
本文介绍了将Date字段中的Null转换为String的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如果该字段中没有日期,我的SQL会在日期字段中返回NULL。

如果此列中有NULL ,当我选择这些记录时,我想用

中的空格替换它我的SELECT语句。你们中的任何一位

专家可以帮我提供一个示例SQL。

Hi,

My SQL returns a NULL in a datefield if there is no date in that field.
If there is a NULL in this column, I want to replace it with spaces in
my SELECT statement when I am selecting these records. Can any of you
experts out there help me with a sample SQL.

推荐答案

SELECT COALESCE( VARCHAR(datefield),'''')来自X ......

sa ** ********@gmail.com 写道:
SELECT COALESCE(VARCHAR(datefield), '''') FROM X...

sa**********@gmail.com wrote:




我的SQL如果该字段中没有日期,则在日期字段中返回NULL。

如果此列中有NULL,我想用空格替换它

我的SELECT我选择这些记录时的陈述。你们中的任何一位

专家可以帮我提供一个示例SQL。
Hi,

My SQL returns a NULL in a datefield if there is no date in that field.
If there is a NULL in this column, I want to replace it with spaces in
my SELECT statement when I am selecting these records. Can any of you
experts out there help me with a sample SQL.


谢谢。我正在尝试合并,但没有把它投到VARCHAR。

我非常感谢你的帮助。它现在有效。


祝你有美好的一天!

jefftyzzer写道:
Thank you. I was trying the coalesce but did not cast it to VARCHAR.
I really appreciate your help. It works now.

Have a good day !
jefftyzzer wrote:

SELECT COALESCE (VARCHAR(datefield),'''')从X ...

sa * *********@gmail.com 写道:




我的如果该字段中没有日期,则SQL在日期字段中返回NULL。

如果此列中有NULL,我想用

中的空格替换它我选择这些记录时的SELECT语句。你们中的任何一位

专家可以帮我提供一个示例SQL。
Hi,

My SQL returns a NULL in a datefield if there is no date in that field.
If there is a NULL in this column, I want to replace it with spaces in
my SELECT statement when I am selecting these records. Can any of you
experts out there help me with a sample SQL.


我的荣幸。很高兴它有效!


- 杰夫

sa ********** @ gmail.com 写道:
My pleasure. Glad it worked!

--Jeff

sa**********@gmail.com wrote:

谢谢。我正在尝试合并,但没有把它投到VARCHAR。

我非常感谢你的帮助。它现在有效。


祝你有美好的一天!

jefftyzzer写道:
Thank you. I was trying the coalesce but did not cast it to VARCHAR.
I really appreciate your help. It works now.

Have a good day !
jefftyzzer wrote:

SELECT COALESCE (VARCHAR(datefield),'''')从X ...

sa * *********@gmail.com 写道:



>

如果该字段中没有日期,我的SQL在日期字段中返回NULL。

如果此列中有NULL,我想用

当我选择这些记录时,我的SELECT语句。你们中的任何一位

专家可以帮我提供一个示例SQL。
Hi,
>
My SQL returns a NULL in a datefield if there is no date in that field.
If there is a NULL in this column, I want to replace it with spaces in
my SELECT statement when I am selecting these records. Can any of you
experts out there help me with a sample SQL.


这篇关于将Date字段中的Null转换为String的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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