You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Write-ObjectToSQL when inserting a DateTime, the table is created correctly but subsequent INSERTs rely on DateTime.ToString() ... this has local issues ...
(Get-Date).ToString()
21/06/2018 18:33:17
In order to insert date/time into SQL Server reliably as a nvarchar, Write-ObjectToSQL should convert date/time objects into the SQL Server default date/time format.
E.g.
I have modified the function including ...
$dateformattypes = @{
# PS datatype = SQL data type
'System.DateTime' = 'datetime';
'datetime' = 'datetime';
}
I did more or less the same local modification by using .toString("o"). Would be really helpful to know that it will find it's way into the final code.
When Write-ObjectToSQL when inserting a DateTime, the table is created correctly but subsequent INSERTs rely on DateTime.ToString() ... this has local issues ...
(Get-Date).ToString()
21/06/2018 18:33:17
In order to insert date/time into SQL Server reliably as a nvarchar, Write-ObjectToSQL should convert date/time objects into the SQL Server default date/time format.
E.g.
I have modified the function including ...
$dateformattypes = @{
# PS datatype = SQL data type
'System.DateTime' = 'datetime';
'datetime' = 'datetime';
}
...
if ( $numbertypes.ContainsKey( $datatype ) ){
$null = $strBuilderColumns.Append(", $quoteFirst$prekey$($key.Replace(' ','_'))$quoteLast")
The text was updated successfully, but these errors were encountered: