From 789abeb765b98074aaf402efa8423170567b4b66 Mon Sep 17 00:00:00 2001 From: Dirk Hondong Date: Fri, 9 Nov 2018 15:11:23 +0100 Subject: [PATCH] Update shared.ps1 function Initialize-Datatable Added datatype decimal to the function to avoid error when running job dbareports - Disk Usage Error from pshell logging is: ERROR: Bulk insert failed - Exception calling "ExecuteNonQuery" with "0" argument(s): "Error converting data type nvarchar to numeric. The data for table-valued parameter "@TVP" doesn't conform to the table type of the parameter. SQL Server error is: 8114, state: 5 The statement has been terminated." In the background a conversion error (nvarchar to numeric) is thrown --- setup/powershell/Shared.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup/powershell/Shared.ps1 b/setup/powershell/Shared.ps1 index ef6ba49..14d707b 100644 --- a/setup/powershell/Shared.ps1 +++ b/setup/powershell/Shared.ps1 @@ -521,6 +521,11 @@ foreach ($result in $results.Tables.rows) { $Column = New-Object system.Data.DataColumn $ColumnName, ([float]) Write-Output "Added $ColumnName of float" + } + elseif($result.data_type -eq 'decimal') + { + $Column = New-Object system.Data.DataColumn $ColumnName, ([decimal]) + Write-Output "Added $ColumnName of float" } else {