title: csv import null value powershell script
body: <p>i have created a table called KS_Invoicing, however the following powershell script wont allow me to import NULL values. any ideas why?</p>
  <pre><code>$database = 'Database'
  $server = '192.168.1.1'
  $table = 'KS_Invoicing'
  $path = '\\hmks01\c$\temp\'
  
  $CSVs = get-childitem $path -Filter *.csv
  foreach ($c in $CSVs){
  
  Import-CSV $path$c | ForEach-Object { 
  $_.PSObject.Properties | Foreach-Object {$_.Value = $_.Value.Trim()} 
  
  $column1= $_.&quot;Column One&quot; 
  
  if ($column1) {
  
  $query= &quot;insert into &quot;+$table+&quot; VALUES ('&quot;+$column1+&quot;')&quot;  
  
  Invoke-Sqlcmd -Database $database -ServerInstance $server -Query $query -U ks  -Password ks2020
  }
  
  }
  Move-Item $path$c &quot;\\hmks01\c$\temp\Archive&quot;
  }
  </code></pre>