在 Powershell Select-Object 中将 'double' 转换为 'Date'
Convert 'double' to 'Date' in Powershell Select-Object
Select-Object -Property Distributor,'File Date','Report Date',Country,'Customer Name)
我正在使用上面的 Select-Object 命令从 excel sheet 中获取 select 数据。当我尝试使用 Write-[= 将 excel 写入 SQL 服务器时,第三列 'Report Date' 抛出以下错误33=]表格数据
The given value of type double from the data source cannot be converted to type data of the specified data column.
如何在 Select-Object 命令中应用 format/convert?
举个例子,你可以如何用 属性:
的值做任何你想做的事
$ScriptBlock = {$_.'Report Date'} # Do your conversion here
$psobject | Select-Object -Property Distributor,'File Date', @{n="Report Date";e=$ScriptBlock}
目前脚本块只选择你的属性,但你可以在那里转换它,转换取决于你的属性
的值
Select-Object -Property Distributor,'File Date','Report Date',Country,'Customer Name)
我正在使用上面的 Select-Object 命令从 excel sheet 中获取 select 数据。当我尝试使用 Write-[= 将 excel 写入 SQL 服务器时,第三列 'Report Date' 抛出以下错误33=]表格数据
The given value of type double from the data source cannot be converted to type data of the specified data column.
如何在 Select-Object 命令中应用 format/convert?
举个例子,你可以如何用 属性:
的值做任何你想做的事$ScriptBlock = {$_.'Report Date'} # Do your conversion here
$psobject | Select-Object -Property Distributor,'File Date', @{n="Report Date";e=$ScriptBlock}
目前脚本块只选择你的属性,但你可以在那里转换它,转换取决于你的属性
的值