0
我有下面的power-shell代码,试图将一个excel文件导入DB1。将文件导入到SQL Server 2012时发生错误
$dir = "\\server\folder\"
$latest = Get-ChildItem -Path $dir | Where-Object {$_.name -like "*Notes*"} | Sort-Object LastWriteTime -Descending | Select-Object -First 1
Write-Output "The latest file is: $latest"
Write-SqlTableData -ServerInstance "instance1" -DatabaseName "DB1" -SchemaName dbo -TableName Table1 -InputData $latest -Force
上午陷入错误,当我运行此代码,见下图:
Write-SqlTableData : A mapping between .Net type 'System.IO.DirectoryInfo' and SQL type for column 'Directory' was not found. Consider removing the column with that type and repeat the operation
我用Google搜索这个错误,似乎没有得到任何帮助。任何人都可以帮助我吗?