下面是背后的故事, 我试图以几种不同的方式验证数据。 我询问过一个数据库, 并将这些数据导出到 csv 中 。
然后用电壳,我执行以下命令
$staleDates = Import-Csv DataAudit.csv | Where-Object { $_.asOfDate -ne "" } | Foreach-Object { $_.AsOfDate = $_.AsOfDate -as [datetime]; $_ } | Where-Object {$_.asOfDate -lt $measuredDate}
$nullDates = Import-Csv DataAudit.csv | Where-Object {$_.asOfDate -eq ""}
$percentTooLarge = Import-Csv DataAudit.csv | Foreach-Object { $_.SumHoldingPercent = $_.SumHoldingPercent -as [float]; $_ } | Where-Object { $_.SumHoldingPercent -gt 100 }
$percentTooSmall = Import-Csv DataAudit.csv | Where-Object {$_.SumHoldingPercent -ne "" } | Foreach-Object { $_.SumHoldingPercent = $_.SumHoldingPercent -as [float]; $_ } | Where-Object {$_.SumHoldingPercent -lt 99.99999 }
我能否将这4个变数的结果 合并成一个CSV 来发邮件作为坏数据报告?
还有,我用的是Powershell v1.0(Powershell v1.0)