Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

syntax help -- checking for value

$
0
0

 

 I'm reading in my csv file and before loading data to SQL want to check a input data for a value and if contains load a Null to SQL field. It appears to skip check and just fail load process saying cant convert "?" to datetime which I'm trying to avoid in check.

 THanks.

if ($_.AD_MOD_DATE -ne "?") {$valid = $true}
								if ($valid)
								 {
 									$date = Get-Date $_.AD_MOD_DATE
									$Row.col18 = $date
								 }
								 else
								 {
								 $Row.col18 = null
								 }


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>