Given this code:
$connection = new-object system.data.sqlclient.sqlconnection( `
"Data Source=$server;Initial Catalog=$instance;Integrated Security=SSPI;");
$adapter = new-object system.data.sqlclient.sqldataadapter ($query, $connection)
$set = new-object system.data.dataset
$adapter.Fill($set) | out-null
$table = new-object system.data.datatable
$table += $set.Tables[0]
$connection.Close()
This then outputs to a .csv (with a select from $table | select Name, etc.), there will be instances where $table will be null (it's parsing through a list to perform this sql query on -- may not be the best, but I'm very new to PoSH).
What I would like is, if $table is null, add these values into $table (ie: N/A), rather than omitting it.
Any thoughts?