如何将 NULL 值更改为空字符串? [英] How do I change NULL values to empty strings?

查看:124
本文介绍了如何将 NULL 值更改为空字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 SSIS 包,它正在将数据从可为 Null 的列复制到同一列不可为 Null 的表中.使源不可为空涉及繁文缛节,所以现在我需要一种方法将空值更改为空字符串.

I have an SSIS Package that is copying data from a column that is Nullable to a table where the same column is not Nullable. There is red tape involved in making the source not nullable so for now I need a way to change the nulls to empty strings.

我从 ADO .Net Source 获取数据,而不是我可以添加 null 检查的查询.如果需要,我可以切换到查询并在那时进行检查.在我这样做之前,我想看看是否有一个 SSIS 转换可以让我将 Null 切换为空字符串(并且仍然使用同一列).

I get the data from an ADO .Net Source, not a query where I could just add a check for null. If need be I can switch to a query and just do the check at that point. Before I do that I wanted to see if there is an SSIS tranformation that would allow me to switch the Null to empty string (and still use the same column).

推荐答案

使用 Derived Column 转换.然后,您可以从派生列下拉列表中选择替换 your_column_name,然后使用以下代码填充表达式属性:

Use the Derived Column transformation. You would then select replace your_column_name from the derived column drop down and then populate the expression property with this code:

ISNULL( [your_column_name]  )  ? " " : [your_column_name] 

希望这会有所帮助.

这篇关于如何将 NULL 值更改为空字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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