我遇到了一个问题,我将一些信息从SQL Server中提取到数据集中。
$adapter.Fill($AnalyticsData)
$AnalyticsData = $AnalyticsData.Tables[0] |
select * -ExcludeProperty RowError, RowState, HasErrors, Name,
Table, ItemArray
问题我得到的是$AnalyticsData
数据集中的某些值为空。虽然,我确实指望数据集中的值似乎忽略了空值:
$EAICount = $AnalyticsData | Sort-Object -Property EtpAssetID -Unique
$SOACount = $AnalyticsData | Sort-Object -Property SharesOutstandingUnadjusted
$NUAWDIFCount = $AnalyticsData | Sort-Object -Property NavUnadjustedWithoutDivIncludeFee
Write-Host "EtpAssetID Unique Count: " .$EAICount.Count
Write-Host "SharesOutstandingUnadjusted Count: " .$SOACount.Count
Write-Host "NavUnadjustedWithoutDivIncludeFee Count: " .$NUAWDIFCount.Count
Write-Host "Non-Unique Count: " .$AnalyticsData.Count
if ($EAICount.Count -eq 12 -and $SOACount.Count -eq 12 -and $NUAWDIFCount.Count -eq 12) {
Write-Host "DataSet is good"
} else {
Write-Host "DataSet is containing one or more null values."
}
有人能指出我正确的方向,我在这里缺少检查数据集中的空值吗?或者我如何跟踪空值?
如果需要更多细节,请告诉我。