在 ETL 过程中处理空值的正确方法 - SSIS 或 SQL 语句

Proper way to Handle Nulls in ETL Process - SSIS or SQL Statement

如果您有一个 SSIS 连接处理 SOURCE 数据库连接从 SQL 语句中提取数据。

对通过 SQL 语句进入的列执行 ISNULL 或执行 Derived Column 并检查每个适用列的 NULL 值是否更有效在表达式中?

一般来说,在查询中进行转换效率更高。

本文解释了 Integration Services 中不同类型和方法的数据转换对性能的影响。

"In terms of overall performance (elapsed time and CPU utilization), performing the data type conversion in the OLE DB layer instead of using Integration Services is the fastest option. Note that the Data Conversion transformation has a run time very similar to the run time of SQL Server’s own data conversion – although it spends more CPU to do the same work..."

http://blogs.msdn.com/b/sqlcat/archive/2009/12/01/draft-performance-comparison-between-data-type-conversion-techniques-in-ssis-2008.aspx

在你的例子中它应该是。

通过简单的转换,派生列转换和使用 t-sql 之间的差异将是微乎其微的(t-sql 稍快)。根据我的经验,ssis 中的大部分额外开销来自数据集的大小以及您正在使用的任务的类型和数量。

此外,如果您只是为此列添加派生列转换,我将在 T-SQL 中进行转换并完全排除额外的数据流任务。

一旦确定哪些记录为空,您将如何处理这些记录?如果您排除空记录,我会使用 T-SQL。