簡體   English   中英

使用 Export-Csv (PowerShell) 命令從 SQL 服務器導出數據時雙引號被轉換為問號 (?)

[英]while exporting data from SQL Server using Export-Csv (PowerShell) command double quotes are converted into question mark (?)

這是我的表格,其中包含“值”列-

價值
這個“數據”)。 由“信息”組成
(“甲方”)和(“乙方”)
Invoke-Sqlcmd -ServerInstance 'SQLSERVER' -Database "SQL" -Query "select * from Table" | Export-Csv -Path "C:\Users\Desktop\Outquery.csv" -NoTypeInformation

此代碼工作正常,但在將數據導出到 CSV 文件時,雙引號被轉換為帶有問號 (?) 的意外值

CSV OUTPUT:-

   VALUE
  -------    
 This ?data?). has consists of ?information?
 (?Party A?) and (?Party B?) 

經過進一步研究,在代碼末尾添加“-Encoding UTF8”后,它現在可以按預期導出。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM