I have a MySQL table table_foo with columns col1 of type DATETIME ,col2 of type int, both accepts NULL values but when inserted from Powershell throws error.
$oMYSQLCommand.CommandText='INSERT into `table_foo` (`col1`,`col2`) VALUES("' + $null + '", "' + $null + '")'
$iRowsAffected=$oMYSQLCommand.ExecuteNonQuery()
also tried using [DBNull]::Value as ref in
$oMYSQLCommand.CommandText='INSERT into `table_foo` (`col1`,`col2`) VALUES("' + [DBNull]::Value + '", "' + $null + '")'
Error
Error: Exception calling "ExecuteNonQuery" with "0" argument(s): "Incorrect datetime value: '' for column 'col1' at row 1"
INSERT into table_foo (col1,col2) VALUES(null, null)nullis not a valid token in powershellINSERT INTO table_foo (col1,col2) VALUES(null, null)is valid mysql